{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 导包"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import sys\n",
    "import os\n",
    "import numpy as np\n",
    "import pandas as pd\n",
    "import torch\n",
    "import aiohttp\n",
    "import asyncio\n",
    "import json\n",
    "import requests\n",
    "from load_test import run_load_test"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 数据处理"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<font color=red>数据已处理好，无需再次运行</font>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Processing: Netflix_data/ratings\\mv_0000004.txt\n",
      "Processing: Netflix_data/ratings\\mv_0000008.txt\n",
      "Processing: Netflix_data/ratings\\mv_0000009.txt\n",
      "Processing: Netflix_data/ratings\\mv_0000014.txt\n",
      "Processing: Netflix_data/ratings\\mv_0000061.txt\n",
      "Processing: Netflix_data/ratings\\mv_0000066.txt\n",
      "Processing: Netflix_data/ratings\\mv_0000074.txt\n",
      "Processing: Netflix_data/ratings\\mv_0000088.txt\n",
      "Processing: Netflix_data/ratings\\mv_0000090.txt\n",
      "Processing: Netflix_data/ratings\\mv_0000095.txt\n",
      "Processing: Netflix_data/ratings\\mv_0000102.txt\n",
      "Processing: Netflix_data/ratings\\mv_0000152.txt\n",
      "Processing: Netflix_data/ratings\\mv_0000174.txt\n",
      "Processing: Netflix_data/ratings\\mv_0000187.txt\n",
      "Processing: Netflix_data/ratings\\mv_0000191.txt\n",
      "Processing: Netflix_data/ratings\\mv_0000204.txt\n",
      "Processing: Netflix_data/ratings\\mv_0000226.txt\n",
      "Processing: Netflix_data/ratings\\mv_0000227.txt\n",
      "Processing: Netflix_data/ratings\\mv_0000278.txt\n",
      "Processing: Netflix_data/ratings\\mv_0000299.txt\n",
      "Processing: Netflix_data/ratings\\mv_0000301.txt\n",
      "Processing: Netflix_data/ratings\\mv_0000313.txt\n",
      "Processing: Netflix_data/ratings\\mv_0000335.txt\n",
      "Processing: Netflix_data/ratings\\mv_0000387.txt\n",
      "Processing: Netflix_data/ratings\\mv_0000424.txt\n",
      "Processing: Netflix_data/ratings\\mv_0000433.txt\n",
      "Processing: Netflix_data/ratings\\mv_0000447.txt\n",
      "Processing: Netflix_data/ratings\\mv_0000463.txt\n",
      "Processing: Netflix_data/ratings\\mv_0000470.txt\n",
      "Processing: Netflix_data/ratings\\mv_0000475.txt\n",
      "Processing: Netflix_data/ratings\\mv_0000484.txt\n",
      "Processing: Netflix_data/ratings\\mv_0000492.txt\n",
      "Processing: Netflix_data/ratings\\mv_0000514.txt\n",
      "Processing: Netflix_data/ratings\\mv_0000519.txt\n",
      "Processing: Netflix_data/ratings\\mv_0000556.txt\n",
      "Processing: Netflix_data/ratings\\mv_0000586.txt\n",
      "Processing: Netflix_data/ratings\\mv_0000609.txt\n",
      "Processing: Netflix_data/ratings\\mv_0000619.txt\n",
      "Processing: Netflix_data/ratings\\mv_0000634.txt\n",
      "Processing: Netflix_data/ratings\\mv_0000662.txt\n",
      "Processing: Netflix_data/ratings\\mv_0000668.txt\n",
      "Processing: Netflix_data/ratings\\mv_0000673.txt\n",
      "Processing: Netflix_data/ratings\\mv_0000688.txt\n",
      "Processing: Netflix_data/ratings\\mv_0000689.txt\n",
      "Processing: Netflix_data/ratings\\mv_0000697.txt\n",
      "Processing: Netflix_data/ratings\\mv_0000704.txt\n",
      "Processing: Netflix_data/ratings\\mv_0000716.txt\n",
      "Processing: Netflix_data/ratings\\mv_0000749.txt\n",
      "Processing: Netflix_data/ratings\\mv_0000758.txt\n",
      "Processing: Netflix_data/ratings\\mv_0000761.txt\n",
      "Processing: Netflix_data/ratings\\mv_0000768.txt\n",
      "Processing: Netflix_data/ratings\\mv_0000828.txt\n",
      "Processing: Netflix_data/ratings\\mv_0000856.txt\n",
      "Processing: Netflix_data/ratings\\mv_0000862.txt\n",
      "Processing: Netflix_data/ratings\\mv_0000871.txt\n",
      "Processing: Netflix_data/ratings\\mv_0000873.txt\n",
      "Processing: Netflix_data/ratings\\mv_0000878.txt\n",
      "Processing: Netflix_data/ratings\\mv_0000880.txt\n",
      "Processing: Netflix_data/ratings\\mv_0000890.txt\n",
      "Processing: Netflix_data/ratings\\mv_0000918.txt\n",
      "Processing: Netflix_data/ratings\\mv_0000924.txt\n",
      "Processing: Netflix_data/ratings\\mv_0000927.txt\n",
      "Processing: Netflix_data/ratings\\mv_0000955.txt\n",
      "Processing: Netflix_data/ratings\\mv_0000972.txt\n",
      "Processing: Netflix_data/ratings\\mv_0000987.txt\n",
      "Processing: Netflix_data/ratings\\mv_0001003.txt\n",
      "Processing: Netflix_data/ratings\\mv_0001008.txt\n",
      "Processing: Netflix_data/ratings\\mv_0001010.txt\n",
      "Processing: Netflix_data/ratings\\mv_0001018.txt\n",
      "Processing: Netflix_data/ratings\\mv_0001036.txt\n",
      "Processing: Netflix_data/ratings\\mv_0001041.txt\n",
      "Processing: Netflix_data/ratings\\mv_0001057.txt\n",
      "Processing: Netflix_data/ratings\\mv_0001060.txt\n",
      "Processing: Netflix_data/ratings\\mv_0001076.txt\n",
      "Processing: Netflix_data/ratings\\mv_0001085.txt\n",
      "Processing: Netflix_data/ratings\\mv_0001090.txt\n",
      "Processing: Netflix_data/ratings\\mv_0001124.txt\n",
      "Processing: Netflix_data/ratings\\mv_0001195.txt\n",
      "Processing: Netflix_data/ratings\\mv_0001263.txt\n",
      "Processing: Netflix_data/ratings\\mv_0001274.txt\n",
      "Processing: Netflix_data/ratings\\mv_0001284.txt\n",
      "Processing: Netflix_data/ratings\\mv_0001348.txt\n",
      "Processing: Netflix_data/ratings\\mv_0001421.txt\n",
      "Processing: Netflix_data/ratings\\mv_0001423.txt\n",
      "Processing: Netflix_data/ratings\\mv_0001424.txt\n",
      "Processing: Netflix_data/ratings\\mv_0001439.txt\n",
      "Processing: Netflix_data/ratings\\mv_0001457.txt\n",
      "Processing: Netflix_data/ratings\\mv_0001468.txt\n",
      "Processing: Netflix_data/ratings\\mv_0001477.txt\n",
      "Processing: Netflix_data/ratings\\mv_0001492.txt\n",
      "Processing: Netflix_data/ratings\\mv_0001499.txt\n",
      "Processing: Netflix_data/ratings\\mv_0001514.txt\n",
      "Processing: Netflix_data/ratings\\mv_0001529.txt\n",
      "Processing: Netflix_data/ratings\\mv_0001555.txt\n",
      "Processing: Netflix_data/ratings\\mv_0001560.txt\n",
      "Processing: Netflix_data/ratings\\mv_0001566.txt\n",
      "Processing: Netflix_data/ratings\\mv_0001580.txt\n",
      "Processing: Netflix_data/ratings\\mv_0001588.txt\n",
      "Processing: Netflix_data/ratings\\mv_0001598.txt\n",
      "Processing: Netflix_data/ratings\\mv_0001604.txt\n",
      "Processing: Netflix_data/ratings\\mv_0001605.txt\n",
      "Processing: Netflix_data/ratings\\mv_0001614.txt\n",
      "Processing: Netflix_data/ratings\\mv_0001626.txt\n",
      "Processing: Netflix_data/ratings\\mv_0001635.txt\n",
      "Processing: Netflix_data/ratings\\mv_0001643.txt\n",
      "Processing: Netflix_data/ratings\\mv_0001650.txt\n",
      "Processing: Netflix_data/ratings\\mv_0001661.txt\n",
      "Processing: Netflix_data/ratings\\mv_0001693.txt\n",
      "Processing: Netflix_data/ratings\\mv_0001696.txt\n",
      "Processing: Netflix_data/ratings\\mv_0001708.txt\n",
      "Processing: Netflix_data/ratings\\mv_0001734.txt\n",
      "Processing: Netflix_data/ratings\\mv_0001747.txt\n",
      "Processing: Netflix_data/ratings\\mv_0001812.txt\n",
      "Processing: Netflix_data/ratings\\mv_0001813.txt\n",
      "Processing: Netflix_data/ratings\\mv_0001823.txt\n",
      "Processing: Netflix_data/ratings\\mv_0001837.txt\n",
      "Processing: Netflix_data/ratings\\mv_0001860.txt\n",
      "Processing: Netflix_data/ratings\\mv_0001897.txt\n",
      "Processing: Netflix_data/ratings\\mv_0001903.txt\n",
      "Processing: Netflix_data/ratings\\mv_0001904.txt\n",
      "Processing: Netflix_data/ratings\\mv_0001924.txt\n",
      "Processing: Netflix_data/ratings\\mv_0001951.txt\n",
      "Processing: Netflix_data/ratings\\mv_0001967.txt\n",
      "Processing: Netflix_data/ratings\\mv_0001972.txt\n",
      "Processing: Netflix_data/ratings\\mv_0002023.txt\n",
      "Processing: Netflix_data/ratings\\mv_0002034.txt\n",
      "Processing: Netflix_data/ratings\\mv_0002037.txt\n",
      "Processing: Netflix_data/ratings\\mv_0002044.txt\n",
      "Processing: Netflix_data/ratings\\mv_0002061.txt\n",
      "Processing: Netflix_data/ratings\\mv_0002064.txt\n",
      "Processing: Netflix_data/ratings\\mv_0002080.txt\n",
      "Processing: Netflix_data/ratings\\mv_0002083.txt\n",
      "Processing: Netflix_data/ratings\\mv_0002108.txt\n",
      "Processing: Netflix_data/ratings\\mv_0002114.txt\n",
      "Processing: Netflix_data/ratings\\mv_0002117.txt\n",
      "Processing: Netflix_data/ratings\\mv_0002133.txt\n",
      "Processing: Netflix_data/ratings\\mv_0002148.txt\n",
      "Processing: Netflix_data/ratings\\mv_0002155.txt\n",
      "Processing: Netflix_data/ratings\\mv_0002156.txt\n",
      "Processing: Netflix_data/ratings\\mv_0002158.txt\n",
      "Processing: Netflix_data/ratings\\mv_0002194.txt\n",
      "Processing: Netflix_data/ratings\\mv_0002219.txt\n",
      "Processing: Netflix_data/ratings\\mv_0002237.txt\n",
      "Processing: Netflix_data/ratings\\mv_0002239.txt\n",
      "Processing: Netflix_data/ratings\\mv_0002268.txt\n",
      "Processing: Netflix_data/ratings\\mv_0002279.txt\n",
      "Processing: Netflix_data/ratings\\mv_0002282.txt\n",
      "Processing: Netflix_data/ratings\\mv_0002306.txt\n",
      "Processing: Netflix_data/ratings\\mv_0002327.txt\n",
      "Processing: Netflix_data/ratings\\mv_0002334.txt\n",
      "Processing: Netflix_data/ratings\\mv_0002346.txt\n",
      "Processing: Netflix_data/ratings\\mv_0002356.txt\n",
      "Processing: Netflix_data/ratings\\mv_0002410.txt\n",
      "Processing: Netflix_data/ratings\\mv_0002426.txt\n",
      "Processing: Netflix_data/ratings\\mv_0002440.txt\n",
      "Processing: Netflix_data/ratings\\mv_0002474.txt\n",
      "Processing: Netflix_data/ratings\\mv_0002477.txt\n",
      "Processing: Netflix_data/ratings\\mv_0002481.txt\n",
      "Processing: Netflix_data/ratings\\mv_0002487.txt\n",
      "Processing: Netflix_data/ratings\\mv_0002519.txt\n",
      "Processing: Netflix_data/ratings\\mv_0002544.txt\n",
      "Processing: Netflix_data/ratings\\mv_0002554.txt\n",
      "Processing: Netflix_data/ratings\\mv_0002559.txt\n",
      "Processing: Netflix_data/ratings\\mv_0002572.txt\n",
      "Processing: Netflix_data/ratings\\mv_0002620.txt\n",
      "Processing: Netflix_data/ratings\\mv_0002697.txt\n",
      "Processing: Netflix_data/ratings\\mv_0002707.txt\n",
      "Processing: Netflix_data/ratings\\mv_0002714.txt\n",
      "Processing: Netflix_data/ratings\\mv_0002717.txt\n",
      "Processing: Netflix_data/ratings\\mv_0002761.txt\n",
      "Processing: Netflix_data/ratings\\mv_0002772.txt\n",
      "Processing: Netflix_data/ratings\\mv_0002795.txt\n",
      "Processing: Netflix_data/ratings\\mv_0002801.txt\n",
      "Processing: Netflix_data/ratings\\mv_0002837.txt\n",
      "Processing: Netflix_data/ratings\\mv_0002847.txt\n",
      "Processing: Netflix_data/ratings\\mv_0002851.txt\n",
      "Processing: Netflix_data/ratings\\mv_0002877.txt\n",
      "Processing: Netflix_data/ratings\\mv_0002885.txt\n",
      "Processing: Netflix_data/ratings\\mv_0002933.txt\n",
      "Processing: Netflix_data/ratings\\mv_0002948.txt\n",
      "Processing: Netflix_data/ratings\\mv_0002965.txt\n",
      "Processing: Netflix_data/ratings\\mv_0002980.txt\n",
      "Processing: Netflix_data/ratings\\mv_0002993.txt\n",
      "Processing: Netflix_data/ratings\\mv_0003004.txt\n",
      "Processing: Netflix_data/ratings\\mv_0003006.txt\n",
      "Processing: Netflix_data/ratings\\mv_0003010.txt\n",
      "Processing: Netflix_data/ratings\\mv_0003018.txt\n",
      "Processing: Netflix_data/ratings\\mv_0003047.txt\n",
      "Processing: Netflix_data/ratings\\mv_0003077.txt\n",
      "Processing: Netflix_data/ratings\\mv_0003085.txt\n",
      "Processing: Netflix_data/ratings\\mv_0003090.txt\n",
      "Processing: Netflix_data/ratings\\mv_0003099.txt\n",
      "Processing: Netflix_data/ratings\\mv_0003107.txt\n",
      "Processing: Netflix_data/ratings\\mv_0003109.txt\n",
      "Processing: Netflix_data/ratings\\mv_0003123.txt\n",
      "Processing: Netflix_data/ratings\\mv_0003159.txt\n",
      "Processing: Netflix_data/ratings\\mv_0003173.txt\n",
      "Processing: Netflix_data/ratings\\mv_0003180.txt\n",
      "Processing: Netflix_data/ratings\\mv_0003182.txt\n",
      "Processing: Netflix_data/ratings\\mv_0003218.txt\n",
      "Processing: Netflix_data/ratings\\mv_0003236.txt\n",
      "Processing: Netflix_data/ratings\\mv_0003240.txt\n",
      "Processing: Netflix_data/ratings\\mv_0003250.txt\n",
      "Processing: Netflix_data/ratings\\mv_0003264.txt\n",
      "Processing: Netflix_data/ratings\\mv_0003328.txt\n",
      "Processing: Netflix_data/ratings\\mv_0003346.txt\n",
      "Processing: Netflix_data/ratings\\mv_0003359.txt\n",
      "Processing: Netflix_data/ratings\\mv_0003370.txt\n",
      "Processing: Netflix_data/ratings\\mv_0003378.txt\n",
      "Processing: Netflix_data/ratings\\mv_0003385.txt\n",
      "Processing: Netflix_data/ratings\\mv_0003387.txt\n",
      "Processing: Netflix_data/ratings\\mv_0003398.txt\n",
      "Processing: Netflix_data/ratings\\mv_0003406.txt\n",
      "Processing: Netflix_data/ratings\\mv_0003410.txt\n",
      "Processing: Netflix_data/ratings\\mv_0003414.txt\n",
      "Processing: Netflix_data/ratings\\mv_0003417.txt\n",
      "Processing: Netflix_data/ratings\\mv_0003424.txt\n",
      "Processing: Netflix_data/ratings\\mv_0003435.txt\n",
      "Processing: Netflix_data/ratings\\mv_0003443.txt\n",
      "Processing: Netflix_data/ratings\\mv_0003494.txt\n",
      "Processing: Netflix_data/ratings\\mv_0003504.txt\n",
      "Processing: Netflix_data/ratings\\mv_0003682.txt\n",
      "Processing: Netflix_data/ratings\\mv_0003729.txt\n",
      "Processing: Netflix_data/ratings\\mv_0003735.txt\n",
      "Processing: Netflix_data/ratings\\mv_0003741.txt\n",
      "Processing: Netflix_data/ratings\\mv_0003754.txt\n",
      "Processing: Netflix_data/ratings\\mv_0003766.txt\n",
      "Processing: Netflix_data/ratings\\mv_0003781.txt\n",
      "Processing: Netflix_data/ratings\\mv_0003784.txt\n",
      "Processing: Netflix_data/ratings\\mv_0003804.txt\n",
      "Processing: Netflix_data/ratings\\mv_0003831.txt\n",
      "Processing: Netflix_data/ratings\\mv_0003833.txt\n",
      "Processing: Netflix_data/ratings\\mv_0003835.txt\n",
      "Processing: Netflix_data/ratings\\mv_0003844.txt\n",
      "Processing: Netflix_data/ratings\\mv_0003852.txt\n",
      "Processing: Netflix_data/ratings\\mv_0003880.txt\n",
      "Processing: Netflix_data/ratings\\mv_0003890.txt\n",
      "Processing: Netflix_data/ratings\\mv_0003907.txt\n",
      "Processing: Netflix_data/ratings\\mv_0003912.txt\n",
      "Processing: Netflix_data/ratings\\mv_0003953.txt\n",
      "Processing: Netflix_data/ratings\\mv_0003975.txt\n",
      "Processing: Netflix_data/ratings\\mv_0003995.txt\n",
      "Processing: Netflix_data/ratings\\mv_0004028.txt\n",
      "Processing: Netflix_data/ratings\\mv_0004047.txt\n",
      "Processing: Netflix_data/ratings\\mv_0004081.txt\n",
      "Processing: Netflix_data/ratings\\mv_0004086.txt\n",
      "Processing: Netflix_data/ratings\\mv_0004112.txt\n",
      "Processing: Netflix_data/ratings\\mv_0004119.txt\n",
      "Processing: Netflix_data/ratings\\mv_0004152.txt\n",
      "Processing: Netflix_data/ratings\\mv_0004155.txt\n",
      "Processing: Netflix_data/ratings\\mv_0004164.txt\n",
      "Processing: Netflix_data/ratings\\mv_0004171.txt\n",
      "Processing: Netflix_data/ratings\\mv_0004177.txt\n",
      "Processing: Netflix_data/ratings\\mv_0004194.txt\n",
      "Processing: Netflix_data/ratings\\mv_0004197.txt\n",
      "Processing: Netflix_data/ratings\\mv_0004214.txt\n",
      "Processing: Netflix_data/ratings\\mv_0004283.txt\n",
      "Processing: Netflix_data/ratings\\mv_0004312.txt\n",
      "Processing: Netflix_data/ratings\\mv_0004329.txt\n",
      "Processing: Netflix_data/ratings\\mv_0004356.txt\n",
      "Processing: Netflix_data/ratings\\mv_0004395.txt\n",
      "Processing: Netflix_data/ratings\\mv_0004466.txt\n",
      "Processing: Netflix_data/ratings\\mv_0004474.txt\n",
      "Processing: Netflix_data/ratings\\mv_0004483.txt\n",
      "Processing: Netflix_data/ratings\\mv_0004497.txt\n",
      "Processing: Netflix_data/ratings\\mv_0004504.txt\n",
      "Processing: Netflix_data/ratings\\mv_0004506.txt\n",
      "Processing: Netflix_data/ratings\\mv_0004525.txt\n",
      "Processing: Netflix_data/ratings\\mv_0004584.txt\n",
      "Processing: Netflix_data/ratings\\mv_0004585.txt\n",
      "Processing: Netflix_data/ratings\\mv_0004597.txt\n",
      "Processing: Netflix_data/ratings\\mv_0004634.txt\n",
      "Processing: Netflix_data/ratings\\mv_0004648.txt\n",
      "Processing: Netflix_data/ratings\\mv_0004661.txt\n",
      "Processing: Netflix_data/ratings\\mv_0004697.txt\n",
      "Processing: Netflix_data/ratings\\mv_0004747.txt\n",
      "Processing: Netflix_data/ratings\\mv_0004751.txt\n",
      "Processing: Netflix_data/ratings\\mv_0004754.txt\n",
      "Processing: Netflix_data/ratings\\mv_0004761.txt\n",
      "Processing: Netflix_data/ratings\\mv_0004763.txt\n",
      "Processing: Netflix_data/ratings\\mv_0004764.txt\n",
      "Processing: Netflix_data/ratings\\mv_0004796.txt\n",
      "Processing: Netflix_data/ratings\\mv_0004800.txt\n",
      "Processing: Netflix_data/ratings\\mv_0004847.txt\n",
      "Processing: Netflix_data/ratings\\mv_0004872.txt\n",
      "Processing: Netflix_data/ratings\\mv_0004934.txt\n",
      "Processing: Netflix_data/ratings\\mv_0004966.txt\n",
      "Processing: Netflix_data/ratings\\mv_0004980.txt\n",
      "Processing: Netflix_data/ratings\\mv_0004988.txt\n",
      "Processing: Netflix_data/ratings\\mv_0005020.txt\n",
      "Processing: Netflix_data/ratings\\mv_0005028.txt\n",
      "Processing: Netflix_data/ratings\\mv_0005030.txt\n",
      "Processing: Netflix_data/ratings\\mv_0005032.txt\n",
      "Processing: Netflix_data/ratings\\mv_0005049.txt\n",
      "Processing: Netflix_data/ratings\\mv_0005051.txt\n",
      "Processing: Netflix_data/ratings\\mv_0005057.txt\n",
      "Processing: Netflix_data/ratings\\mv_0005062.txt\n",
      "Processing: Netflix_data/ratings\\mv_0005067.txt\n",
      "Processing: Netflix_data/ratings\\mv_0005068.txt\n",
      "Processing: Netflix_data/ratings\\mv_0005075.txt\n",
      "Processing: Netflix_data/ratings\\mv_0005086.txt\n",
      "Processing: Netflix_data/ratings\\mv_0005096.txt\n",
      "Processing: Netflix_data/ratings\\mv_0005119.txt\n",
      "Processing: Netflix_data/ratings\\mv_0005125.txt\n",
      "Processing: Netflix_data/ratings\\mv_0005148.txt\n",
      "Processing: Netflix_data/ratings\\mv_0005150.txt\n",
      "Processing: Netflix_data/ratings\\mv_0005160.txt\n",
      "Processing: Netflix_data/ratings\\mv_0005187.txt\n",
      "Processing: Netflix_data/ratings\\mv_0005193.txt\n",
      "Processing: Netflix_data/ratings\\mv_0005212.txt\n",
      "Processing: Netflix_data/ratings\\mv_0005222.txt\n",
      "Processing: Netflix_data/ratings\\mv_0005232.txt\n",
      "Processing: Netflix_data/ratings\\mv_0005233.txt\n",
      "Processing: Netflix_data/ratings\\mv_0005234.txt\n",
      "Processing: Netflix_data/ratings\\mv_0005248.txt\n",
      "Processing: Netflix_data/ratings\\mv_0005256.txt\n",
      "Processing: Netflix_data/ratings\\mv_0005273.txt\n",
      "Processing: Netflix_data/ratings\\mv_0005279.txt\n",
      "Processing: Netflix_data/ratings\\mv_0005289.txt\n",
      "Processing: Netflix_data/ratings\\mv_0005305.txt\n",
      "Processing: Netflix_data/ratings\\mv_0005318.txt\n",
      "Processing: Netflix_data/ratings\\mv_0005357.txt\n",
      "Processing: Netflix_data/ratings\\mv_0005358.txt\n",
      "Processing: Netflix_data/ratings\\mv_0005399.txt\n",
      "Processing: Netflix_data/ratings\\mv_0005405.txt\n",
      "Processing: Netflix_data/ratings\\mv_0005427.txt\n",
      "Processing: Netflix_data/ratings\\mv_0005435.txt\n",
      "Processing: Netflix_data/ratings\\mv_0005442.txt\n",
      "Processing: Netflix_data/ratings\\mv_0005458.txt\n",
      "Processing: Netflix_data/ratings\\mv_0005462.txt\n",
      "Processing: Netflix_data/ratings\\mv_0005509.txt\n",
      "Processing: Netflix_data/ratings\\mv_0005518.txt\n",
      "Processing: Netflix_data/ratings\\mv_0005539.txt\n",
      "Processing: Netflix_data/ratings\\mv_0005561.txt\n",
      "Processing: Netflix_data/ratings\\mv_0005569.txt\n",
      "Processing: Netflix_data/ratings\\mv_0005573.txt\n",
      "Processing: Netflix_data/ratings\\mv_0005612.txt\n",
      "Processing: Netflix_data/ratings\\mv_0005617.txt\n",
      "Processing: Netflix_data/ratings\\mv_0005624.txt\n",
      "Processing: Netflix_data/ratings\\mv_0005626.txt\n",
      "Processing: Netflix_data/ratings\\mv_0005663.txt\n",
      "Processing: Netflix_data/ratings\\mv_0005667.txt\n",
      "Processing: Netflix_data/ratings\\mv_0005675.txt\n",
      "Processing: Netflix_data/ratings\\mv_0005678.txt\n",
      "Processing: Netflix_data/ratings\\mv_0005710.txt\n",
      "Processing: Netflix_data/ratings\\mv_0005711.txt\n",
      "Processing: Netflix_data/ratings\\mv_0005716.txt\n",
      "Processing: Netflix_data/ratings\\mv_0005726.txt\n",
      "Processing: Netflix_data/ratings\\mv_0005732.txt\n",
      "Processing: Netflix_data/ratings\\mv_0005834.txt\n",
      "Processing: Netflix_data/ratings\\mv_0005872.txt\n",
      "Processing: Netflix_data/ratings\\mv_0005873.txt\n",
      "Processing: Netflix_data/ratings\\mv_0005913.txt\n",
      "Processing: Netflix_data/ratings\\mv_0005915.txt\n",
      "Processing: Netflix_data/ratings\\mv_0005936.txt\n",
      "Processing: Netflix_data/ratings\\mv_0005977.txt\n",
      "Processing: Netflix_data/ratings\\mv_0005994.txt\n",
      "Processing: Netflix_data/ratings\\mv_0006001.txt\n",
      "Processing: Netflix_data/ratings\\mv_0006018.txt\n",
      "Processing: Netflix_data/ratings\\mv_0006028.txt\n",
      "Processing: Netflix_data/ratings\\mv_0006033.txt\n",
      "Processing: Netflix_data/ratings\\mv_0006078.txt\n",
      "Processing: Netflix_data/ratings\\mv_0006085.txt\n",
      "Processing: Netflix_data/ratings\\mv_0006089.txt\n",
      "Processing: Netflix_data/ratings\\mv_0006095.txt\n",
      "Processing: Netflix_data/ratings\\mv_0006121.txt\n",
      "Processing: Netflix_data/ratings\\mv_0006123.txt\n",
      "Processing: Netflix_data/ratings\\mv_0006137.txt\n",
      "Processing: Netflix_data/ratings\\mv_0006156.txt\n",
      "Processing: Netflix_data/ratings\\mv_0006206.txt\n",
      "Processing: Netflix_data/ratings\\mv_0006237.txt\n",
      "Processing: Netflix_data/ratings\\mv_0006251.txt\n",
      "Processing: Netflix_data/ratings\\mv_0006258.txt\n",
      "Processing: Netflix_data/ratings\\mv_0006274.txt\n",
      "Processing: Netflix_data/ratings\\mv_0006285.txt\n",
      "Processing: Netflix_data/ratings\\mv_0006292.txt\n",
      "Processing: Netflix_data/ratings\\mv_0006294.txt\n",
      "Processing: Netflix_data/ratings\\mv_0006306.txt\n",
      "Processing: Netflix_data/ratings\\mv_0006334.txt\n",
      "Processing: Netflix_data/ratings\\mv_0006335.txt\n",
      "Processing: Netflix_data/ratings\\mv_0006356.txt\n",
      "Processing: Netflix_data/ratings\\mv_0006382.txt\n",
      "Processing: Netflix_data/ratings\\mv_0006392.txt\n",
      "Processing: Netflix_data/ratings\\mv_0006397.txt\n",
      "Processing: Netflix_data/ratings\\mv_0006418.txt\n",
      "Processing: Netflix_data/ratings\\mv_0006462.txt\n",
      "Processing: Netflix_data/ratings\\mv_0006463.txt\n",
      "Processing: Netflix_data/ratings\\mv_0006473.txt\n",
      "Processing: Netflix_data/ratings\\mv_0006477.txt\n",
      "Processing: Netflix_data/ratings\\mv_0006485.txt\n",
      "Processing: Netflix_data/ratings\\mv_0006562.txt\n",
      "Processing: Netflix_data/ratings\\mv_0006569.txt\n",
      "Processing: Netflix_data/ratings\\mv_0006579.txt\n",
      "Processing: Netflix_data/ratings\\mv_0006580.txt\n",
      "Processing: Netflix_data/ratings\\mv_0006599.txt\n",
      "Processing: Netflix_data/ratings\\mv_0006608.txt\n",
      "Processing: Netflix_data/ratings\\mv_0006610.txt\n",
      "Processing: Netflix_data/ratings\\mv_0006632.txt\n",
      "Processing: Netflix_data/ratings\\mv_0006713.txt\n",
      "Processing: Netflix_data/ratings\\mv_0006722.txt\n",
      "Processing: Netflix_data/ratings\\mv_0006732.txt\n",
      "Processing: Netflix_data/ratings\\mv_0006758.txt\n",
      "Processing: Netflix_data/ratings\\mv_0006819.txt\n",
      "Processing: Netflix_data/ratings\\mv_0006821.txt\n",
      "Processing: Netflix_data/ratings\\mv_0006834.txt\n",
      "Processing: Netflix_data/ratings\\mv_0006840.txt\n",
      "Processing: Netflix_data/ratings\\mv_0006844.txt\n",
      "Processing: Netflix_data/ratings\\mv_0006874.txt\n",
      "Processing: Netflix_data/ratings\\mv_0006881.txt\n",
      "Processing: Netflix_data/ratings\\mv_0006883.txt\n",
      "Processing: Netflix_data/ratings\\mv_0006887.txt\n",
      "Processing: Netflix_data/ratings\\mv_0006897.txt\n",
      "Processing: Netflix_data/ratings\\mv_0006972.txt\n",
      "Processing: Netflix_data/ratings\\mv_0006985.txt\n",
      "Processing: Netflix_data/ratings\\mv_0007008.txt\n",
      "Processing: Netflix_data/ratings\\mv_0007015.txt\n",
      "Processing: Netflix_data/ratings\\mv_0007016.txt\n",
      "Processing: Netflix_data/ratings\\mv_0007026.txt\n",
      "Processing: Netflix_data/ratings\\mv_0007041.txt\n",
      "Processing: Netflix_data/ratings\\mv_0007055.txt\n",
      "Processing: Netflix_data/ratings\\mv_0007063.txt\n",
      "Processing: Netflix_data/ratings\\mv_0007079.txt\n",
      "Processing: Netflix_data/ratings\\mv_0007090.txt\n",
      "Processing: Netflix_data/ratings\\mv_0007104.txt\n",
      "Processing: Netflix_data/ratings\\mv_0007117.txt\n",
      "Processing: Netflix_data/ratings\\mv_0007151.txt\n",
      "Processing: Netflix_data/ratings\\mv_0007162.txt\n",
      "Processing: Netflix_data/ratings\\mv_0007166.txt\n",
      "Processing: Netflix_data/ratings\\mv_0007180.txt\n",
      "Processing: Netflix_data/ratings\\mv_0007185.txt\n",
      "Processing: Netflix_data/ratings\\mv_0007219.txt\n",
      "Processing: Netflix_data/ratings\\mv_0007225.txt\n",
      "Processing: Netflix_data/ratings\\mv_0007231.txt\n",
      "Processing: Netflix_data/ratings\\mv_0007235.txt\n",
      "Processing: Netflix_data/ratings\\mv_0007271.txt\n",
      "Processing: Netflix_data/ratings\\mv_0007278.txt\n",
      "Processing: Netflix_data/ratings\\mv_0007287.txt\n",
      "Processing: Netflix_data/ratings\\mv_0007363.txt\n",
      "Processing: Netflix_data/ratings\\mv_0007368.txt\n",
      "Processing: Netflix_data/ratings\\mv_0007373.txt\n",
      "Processing: Netflix_data/ratings\\mv_0007386.txt\n",
      "Processing: Netflix_data/ratings\\mv_0007388.txt\n",
      "Processing: Netflix_data/ratings\\mv_0007392.txt\n",
      "Processing: Netflix_data/ratings\\mv_0007422.txt\n",
      "Processing: Netflix_data/ratings\\mv_0007430.txt\n",
      "Processing: Netflix_data/ratings\\mv_0007436.txt\n",
      "Processing: Netflix_data/ratings\\mv_0007462.txt\n",
      "Processing: Netflix_data/ratings\\mv_0007488.txt\n",
      "Processing: Netflix_data/ratings\\mv_0007510.txt\n",
      "Processing: Netflix_data/ratings\\mv_0007517.txt\n",
      "Processing: Netflix_data/ratings\\mv_0007567.txt\n",
      "Processing: Netflix_data/ratings\\mv_0007575.txt\n",
      "Processing: Netflix_data/ratings\\mv_0007597.txt\n",
      "Processing: Netflix_data/ratings\\mv_0007645.txt\n",
      "Processing: Netflix_data/ratings\\mv_0007693.txt\n",
      "Processing: Netflix_data/ratings\\mv_0007696.txt\n",
      "Processing: Netflix_data/ratings\\mv_0007697.txt\n",
      "Processing: Netflix_data/ratings\\mv_0007705.txt\n",
      "Processing: Netflix_data/ratings\\mv_0007714.txt\n",
      "Processing: Netflix_data/ratings\\mv_0007715.txt\n",
      "Processing: Netflix_data/ratings\\mv_0007720.txt\n",
      "Processing: Netflix_data/ratings\\mv_0007728.txt\n",
      "Processing: Netflix_data/ratings\\mv_0007734.txt\n",
      "Processing: Netflix_data/ratings\\mv_0007774.txt\n",
      "Processing: Netflix_data/ratings\\mv_0007777.txt\n",
      "Processing: Netflix_data/ratings\\mv_0007799.txt\n",
      "Processing: Netflix_data/ratings\\mv_0007806.txt\n",
      "Processing: Netflix_data/ratings\\mv_0007824.txt\n",
      "Processing: Netflix_data/ratings\\mv_0007851.txt\n",
      "Processing: Netflix_data/ratings\\mv_0007859.txt\n",
      "Processing: Netflix_data/ratings\\mv_0007861.txt\n",
      "Processing: Netflix_data/ratings\\mv_0007877.txt\n",
      "Processing: Netflix_data/ratings\\mv_0007882.txt\n",
      "Processing: Netflix_data/ratings\\mv_0007900.txt\n",
      "Processing: Netflix_data/ratings\\mv_0007915.txt\n",
      "Processing: Netflix_data/ratings\\mv_0007950.txt\n",
      "Processing: Netflix_data/ratings\\mv_0007980.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008000.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008009.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008012.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008013.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008029.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008045.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008084.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008092.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008098.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008151.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008156.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008167.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008179.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008202.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008212.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008234.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008237.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008261.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008268.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008285.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008321.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008336.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008341.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008349.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008356.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008369.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008376.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008386.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008409.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008423.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008434.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008437.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008442.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008450.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008471.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008474.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008477.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008491.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008518.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008539.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008550.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008568.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008574.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008576.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008577.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008583.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008619.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008643.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008648.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008649.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008658.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008672.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008685.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008689.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008699.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008727.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008754.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008759.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008761.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008774.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008783.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008786.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008826.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008839.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008842.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008847.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008859.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008866.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008907.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008932.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008935.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008936.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008941.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008970.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008974.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008975.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008976.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008978.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008982.txt\n",
      "Processing: Netflix_data/ratings\\mv_0008986.txt\n",
      "Processing: Netflix_data/ratings\\mv_0009024.txt\n",
      "Processing: Netflix_data/ratings\\mv_0009037.txt\n",
      "Processing: Netflix_data/ratings\\mv_0009047.txt\n",
      "Processing: Netflix_data/ratings\\mv_0009063.txt\n",
      "Processing: Netflix_data/ratings\\mv_0009066.txt\n",
      "Processing: Netflix_data/ratings\\mv_0009067.txt\n",
      "Processing: Netflix_data/ratings\\mv_0009086.txt\n",
      "Processing: Netflix_data/ratings\\mv_0009116.txt\n",
      "Processing: Netflix_data/ratings\\mv_0009120.txt\n",
      "Processing: Netflix_data/ratings\\mv_0009132.txt\n",
      "Processing: Netflix_data/ratings\\mv_0009160.txt\n",
      "Processing: Netflix_data/ratings\\mv_0009162.txt\n",
      "Processing: Netflix_data/ratings\\mv_0009169.txt\n",
      "Processing: Netflix_data/ratings\\mv_0009185.txt\n",
      "Processing: Netflix_data/ratings\\mv_0009205.txt\n",
      "Processing: Netflix_data/ratings\\mv_0009212.txt\n",
      "Processing: Netflix_data/ratings\\mv_0009214.txt\n",
      "Processing: Netflix_data/ratings\\mv_0009219.txt\n",
      "Processing: Netflix_data/ratings\\mv_0009237.txt\n",
      "Processing: Netflix_data/ratings\\mv_0009239.txt\n",
      "Processing: Netflix_data/ratings\\mv_0009266.txt\n",
      "Processing: Netflix_data/ratings\\mv_0009272.txt\n",
      "Processing: Netflix_data/ratings\\mv_0009279.txt\n",
      "Processing: Netflix_data/ratings\\mv_0009297.txt\n",
      "Processing: Netflix_data/ratings\\mv_0009304.txt\n",
      "Processing: Netflix_data/ratings\\mv_0009330.txt\n",
      "Processing: Netflix_data/ratings\\mv_0009331.txt\n",
      "Processing: Netflix_data/ratings\\mv_0009346.txt\n",
      "Processing: Netflix_data/ratings\\mv_0009360.txt\n",
      "Processing: Netflix_data/ratings\\mv_0009362.txt\n",
      "Processing: Netflix_data/ratings\\mv_0009386.txt\n",
      "Processing: Netflix_data/ratings\\mv_0009396.txt\n",
      "Processing: Netflix_data/ratings\\mv_0009401.txt\n",
      "Processing: Netflix_data/ratings\\mv_0009409.txt\n",
      "Processing: Netflix_data/ratings\\mv_0009416.txt\n",
      "Processing: Netflix_data/ratings\\mv_0009450.txt\n",
      "Processing: Netflix_data/ratings\\mv_0009463.txt\n",
      "Processing: Netflix_data/ratings\\mv_0009469.txt\n",
      "Processing: Netflix_data/ratings\\mv_0009470.txt\n",
      "Processing: Netflix_data/ratings\\mv_0009491.txt\n",
      "Processing: Netflix_data/ratings\\mv_0009499.txt\n",
      "Processing: Netflix_data/ratings\\mv_0009515.txt\n",
      "Processing: Netflix_data/ratings\\mv_0009557.txt\n",
      "Processing: Netflix_data/ratings\\mv_0009559.txt\n",
      "Processing: Netflix_data/ratings\\mv_0009573.txt\n",
      "Processing: Netflix_data/ratings\\mv_0009579.txt\n",
      "Processing: Netflix_data/ratings\\mv_0009609.txt\n",
      "Processing: Netflix_data/ratings\\mv_0009627.txt\n",
      "Processing: Netflix_data/ratings\\mv_0009635.txt\n",
      "Processing: Netflix_data/ratings\\mv_0009651.txt\n",
      "Processing: Netflix_data/ratings\\mv_0009667.txt\n",
      "Processing: Netflix_data/ratings\\mv_0009669.txt\n",
      "Processing: Netflix_data/ratings\\mv_0009680.txt\n",
      "Processing: Netflix_data/ratings\\mv_0009780.txt\n",
      "Processing: Netflix_data/ratings\\mv_0009793.txt\n",
      "Processing: Netflix_data/ratings\\mv_0009798.txt\n",
      "Processing: Netflix_data/ratings\\mv_0009814.txt\n",
      "Processing: Netflix_data/ratings\\mv_0009879.txt\n",
      "Processing: Netflix_data/ratings\\mv_0009892.txt\n",
      "Processing: Netflix_data/ratings\\mv_0009919.txt\n",
      "Processing: Netflix_data/ratings\\mv_0009945.txt\n",
      "Processing: Netflix_data/ratings\\mv_0009947.txt\n",
      "Processing: Netflix_data/ratings\\mv_0009951.txt\n",
      "Processing: Netflix_data/ratings\\mv_0009964.txt\n",
      "Processing: Netflix_data/ratings\\mv_0009991.txt\n",
      "Processing: Netflix_data/ratings\\mv_0010015.txt\n",
      "Processing: Netflix_data/ratings\\mv_0010047.txt\n",
      "Processing: Netflix_data/ratings\\mv_0010050.txt\n",
      "Processing: Netflix_data/ratings\\mv_0010068.txt\n",
      "Processing: Netflix_data/ratings\\mv_0010099.txt\n",
      "Processing: Netflix_data/ratings\\mv_0010151.txt\n",
      "Processing: Netflix_data/ratings\\mv_0010152.txt\n",
      "Processing: Netflix_data/ratings\\mv_0010161.txt\n",
      "Processing: Netflix_data/ratings\\mv_0010167.txt\n",
      "Processing: Netflix_data/ratings\\mv_0010241.txt\n",
      "Processing: Netflix_data/ratings\\mv_0010253.txt\n",
      "Processing: Netflix_data/ratings\\mv_0010262.txt\n",
      "Processing: Netflix_data/ratings\\mv_0010264.txt\n",
      "Processing: Netflix_data/ratings\\mv_0010271.txt\n",
      "Processing: Netflix_data/ratings\\mv_0010276.txt\n",
      "Processing: Netflix_data/ratings\\mv_0010282.txt\n",
      "Processing: Netflix_data/ratings\\mv_0010315.txt\n",
      "Processing: Netflix_data/ratings\\mv_0010387.txt\n",
      "Processing: Netflix_data/ratings\\mv_0010397.txt\n",
      "Processing: Netflix_data/ratings\\mv_0010405.txt\n",
      "Processing: Netflix_data/ratings\\mv_0010428.txt\n",
      "Processing: Netflix_data/ratings\\mv_0010465.txt\n",
      "Processing: Netflix_data/ratings\\mv_0010485.txt\n",
      "Processing: Netflix_data/ratings\\mv_0010510.txt\n",
      "Processing: Netflix_data/ratings\\mv_0010537.txt\n",
      "Processing: Netflix_data/ratings\\mv_0010542.txt\n",
      "Processing: Netflix_data/ratings\\mv_0010543.txt\n",
      "Processing: Netflix_data/ratings\\mv_0010544.txt\n",
      "Processing: Netflix_data/ratings\\mv_0010564.txt\n",
      "Processing: Netflix_data/ratings\\mv_0010572.txt\n",
      "Processing: Netflix_data/ratings\\mv_0010583.txt\n",
      "Processing: Netflix_data/ratings\\mv_0010586.txt\n",
      "Processing: Netflix_data/ratings\\mv_0010589.txt\n",
      "Processing: Netflix_data/ratings\\mv_0010608.txt\n",
      "Processing: Netflix_data/ratings\\mv_0010680.txt\n",
      "Processing: Netflix_data/ratings\\mv_0010688.txt\n",
      "Processing: Netflix_data/ratings\\mv_0010691.txt\n",
      "Processing: Netflix_data/ratings\\mv_0010695.txt\n",
      "Processing: Netflix_data/ratings\\mv_0010713.txt\n",
      "Processing: Netflix_data/ratings\\mv_0010728.txt\n",
      "Processing: Netflix_data/ratings\\mv_0010758.txt\n",
      "Processing: Netflix_data/ratings\\mv_0010787.txt\n",
      "Processing: Netflix_data/ratings\\mv_0010798.txt\n",
      "Processing: Netflix_data/ratings\\mv_0010823.txt\n",
      "Processing: Netflix_data/ratings\\mv_0010828.txt\n",
      "Processing: Netflix_data/ratings\\mv_0010829.txt\n",
      "Processing: Netflix_data/ratings\\mv_0010840.txt\n",
      "Processing: Netflix_data/ratings\\mv_0010843.txt\n",
      "Processing: Netflix_data/ratings\\mv_0010848.txt\n",
      "Processing: Netflix_data/ratings\\mv_0010851.txt\n",
      "Processing: Netflix_data/ratings\\mv_0010869.txt\n",
      "Processing: Netflix_data/ratings\\mv_0010875.txt\n",
      "Processing: Netflix_data/ratings\\mv_0010894.txt\n",
      "Processing: Netflix_data/ratings\\mv_0010908.txt\n",
      "Processing: Netflix_data/ratings\\mv_0010925.txt\n",
      "Processing: Netflix_data/ratings\\mv_0010931.txt\n",
      "Processing: Netflix_data/ratings\\mv_0010934.txt\n",
      "Processing: Netflix_data/ratings\\mv_0010975.txt\n",
      "Processing: Netflix_data/ratings\\mv_0010983.txt\n",
      "Processing: Netflix_data/ratings\\mv_0010985.txt\n",
      "Processing: Netflix_data/ratings\\mv_0010993.txt\n",
      "Processing: Netflix_data/ratings\\mv_0010995.txt\n",
      "Processing: Netflix_data/ratings\\mv_0011043.txt\n",
      "Processing: Netflix_data/ratings\\mv_0011044.txt\n",
      "Processing: Netflix_data/ratings\\mv_0011078.txt\n",
      "Processing: Netflix_data/ratings\\mv_0011082.txt\n",
      "Processing: Netflix_data/ratings\\mv_0011106.txt\n",
      "Processing: Netflix_data/ratings\\mv_0011109.txt\n",
      "Processing: Netflix_data/ratings\\mv_0011130.txt\n",
      "Processing: Netflix_data/ratings\\mv_0011147.txt\n",
      "Processing: Netflix_data/ratings\\mv_0011150.txt\n",
      "Processing: Netflix_data/ratings\\mv_0011158.txt\n",
      "Processing: Netflix_data/ratings\\mv_0011159.txt\n",
      "Processing: Netflix_data/ratings\\mv_0011166.txt\n",
      "Processing: Netflix_data/ratings\\mv_0011213.txt\n",
      "Processing: Netflix_data/ratings\\mv_0011220.txt\n",
      "Processing: Netflix_data/ratings\\mv_0011252.txt\n",
      "Processing: Netflix_data/ratings\\mv_0011283.txt\n",
      "Processing: Netflix_data/ratings\\mv_0011302.txt\n",
      "Processing: Netflix_data/ratings\\mv_0011304.txt\n",
      "Processing: Netflix_data/ratings\\mv_0011311.txt\n",
      "Processing: Netflix_data/ratings\\mv_0011321.txt\n",
      "Processing: Netflix_data/ratings\\mv_0011335.txt\n",
      "Processing: Netflix_data/ratings\\mv_0011339.txt\n",
      "Processing: Netflix_data/ratings\\mv_0011412.txt\n",
      "Processing: Netflix_data/ratings\\mv_0011419.txt\n",
      "Processing: Netflix_data/ratings\\mv_0011438.txt\n",
      "Processing: Netflix_data/ratings\\mv_0011457.txt\n",
      "Processing: Netflix_data/ratings\\mv_0011497.txt\n",
      "Processing: Netflix_data/ratings\\mv_0011510.txt\n",
      "Processing: Netflix_data/ratings\\mv_0011530.txt\n",
      "Processing: Netflix_data/ratings\\mv_0011532.txt\n",
      "Processing: Netflix_data/ratings\\mv_0011535.txt\n",
      "Processing: Netflix_data/ratings\\mv_0011538.txt\n",
      "Processing: Netflix_data/ratings\\mv_0011566.txt\n",
      "Processing: Netflix_data/ratings\\mv_0011572.txt\n",
      "Processing: Netflix_data/ratings\\mv_0011584.txt\n",
      "Processing: Netflix_data/ratings\\mv_0011598.txt\n",
      "Processing: Netflix_data/ratings\\mv_0011627.txt\n",
      "Processing: Netflix_data/ratings\\mv_0011629.txt\n",
      "Processing: Netflix_data/ratings\\mv_0011650.txt\n",
      "Processing: Netflix_data/ratings\\mv_0011667.txt\n",
      "Processing: Netflix_data/ratings\\mv_0011696.txt\n",
      "Processing: Netflix_data/ratings\\mv_0011707.txt\n",
      "Processing: Netflix_data/ratings\\mv_0011720.txt\n",
      "Processing: Netflix_data/ratings\\mv_0011749.txt\n",
      "Processing: Netflix_data/ratings\\mv_0011802.txt\n",
      "Processing: Netflix_data/ratings\\mv_0011805.txt\n",
      "Processing: Netflix_data/ratings\\mv_0011813.txt\n",
      "Processing: Netflix_data/ratings\\mv_0011818.txt\n",
      "Processing: Netflix_data/ratings\\mv_0011881.txt\n",
      "Processing: Netflix_data/ratings\\mv_0011890.txt\n",
      "Processing: Netflix_data/ratings\\mv_0011941.txt\n",
      "Processing: Netflix_data/ratings\\mv_0011980.txt\n",
      "Processing: Netflix_data/ratings\\mv_0011981.txt\n",
      "Processing: Netflix_data/ratings\\mv_0012003.txt\n",
      "Processing: Netflix_data/ratings\\mv_0012022.txt\n",
      "Processing: Netflix_data/ratings\\mv_0012033.txt\n",
      "Processing: Netflix_data/ratings\\mv_0012035.txt\n",
      "Processing: Netflix_data/ratings\\mv_0012049.txt\n",
      "Processing: Netflix_data/ratings\\mv_0012076.txt\n",
      "Processing: Netflix_data/ratings\\mv_0012088.txt\n",
      "Processing: Netflix_data/ratings\\mv_0012096.txt\n",
      "Processing: Netflix_data/ratings\\mv_0012111.txt\n",
      "Processing: Netflix_data/ratings\\mv_0012120.txt\n",
      "Processing: Netflix_data/ratings\\mv_0012146.txt\n",
      "Processing: Netflix_data/ratings\\mv_0012177.txt\n",
      "Processing: Netflix_data/ratings\\mv_0012198.txt\n",
      "Processing: Netflix_data/ratings\\mv_0012204.txt\n",
      "Processing: Netflix_data/ratings\\mv_0012229.txt\n",
      "Processing: Netflix_data/ratings\\mv_0012252.txt\n",
      "Processing: Netflix_data/ratings\\mv_0012265.txt\n",
      "Processing: Netflix_data/ratings\\mv_0012272.txt\n",
      "Processing: Netflix_data/ratings\\mv_0012274.txt\n",
      "Processing: Netflix_data/ratings\\mv_0012275.txt\n",
      "Processing: Netflix_data/ratings\\mv_0012305.txt\n",
      "Processing: Netflix_data/ratings\\mv_0012351.txt\n",
      "Processing: Netflix_data/ratings\\mv_0012361.txt\n",
      "Processing: Netflix_data/ratings\\mv_0012370.txt\n",
      "Processing: Netflix_data/ratings\\mv_0012383.txt\n",
      "Processing: Netflix_data/ratings\\mv_0012389.txt\n",
      "Processing: Netflix_data/ratings\\mv_0012392.txt\n",
      "Processing: Netflix_data/ratings\\mv_0012395.txt\n",
      "Processing: Netflix_data/ratings\\mv_0012418.txt\n",
      "Processing: Netflix_data/ratings\\mv_0012455.txt\n",
      "Processing: Netflix_data/ratings\\mv_0012484.txt\n",
      "Processing: Netflix_data/ratings\\mv_0012488.txt\n",
      "Processing: Netflix_data/ratings\\mv_0012489.txt\n",
      "Processing: Netflix_data/ratings\\mv_0012497.txt\n",
      "Processing: Netflix_data/ratings\\mv_0012499.txt\n",
      "Processing: Netflix_data/ratings\\mv_0012539.txt\n",
      "Processing: Netflix_data/ratings\\mv_0012552.txt\n",
      "Processing: Netflix_data/ratings\\mv_0012554.txt\n",
      "Processing: Netflix_data/ratings\\mv_0012589.txt\n",
      "Processing: Netflix_data/ratings\\mv_0012599.txt\n",
      "Processing: Netflix_data/ratings\\mv_0012629.txt\n",
      "Processing: Netflix_data/ratings\\mv_0012671.txt\n",
      "Processing: Netflix_data/ratings\\mv_0012673.txt\n",
      "Processing: Netflix_data/ratings\\mv_0012730.txt\n",
      "Processing: Netflix_data/ratings\\mv_0012731.txt\n",
      "Processing: Netflix_data/ratings\\mv_0012735.txt\n",
      "Processing: Netflix_data/ratings\\mv_0012746.txt\n",
      "Processing: Netflix_data/ratings\\mv_0012754.txt\n",
      "Processing: Netflix_data/ratings\\mv_0012763.txt\n",
      "Processing: Netflix_data/ratings\\mv_0012765.txt\n",
      "Processing: Netflix_data/ratings\\mv_0012767.txt\n",
      "Processing: Netflix_data/ratings\\mv_0012780.txt\n",
      "Processing: Netflix_data/ratings\\mv_0012784.txt\n",
      "Processing: Netflix_data/ratings\\mv_0012797.txt\n",
      "Processing: Netflix_data/ratings\\mv_0012811.txt\n",
      "Processing: Netflix_data/ratings\\mv_0012840.txt\n",
      "Processing: Netflix_data/ratings\\mv_0012846.txt\n",
      "Processing: Netflix_data/ratings\\mv_0012848.txt\n",
      "Processing: Netflix_data/ratings\\mv_0012909.txt\n",
      "Processing: Netflix_data/ratings\\mv_0012939.txt\n",
      "Processing: Netflix_data/ratings\\mv_0012951.txt\n",
      "Processing: Netflix_data/ratings\\mv_0012962.txt\n",
      "Processing: Netflix_data/ratings\\mv_0012989.txt\n",
      "Processing: Netflix_data/ratings\\mv_0012993.txt\n",
      "Processing: Netflix_data/ratings\\mv_0013005.txt\n",
      "Processing: Netflix_data/ratings\\mv_0013015.txt\n",
      "Processing: Netflix_data/ratings\\mv_0013016.txt\n",
      "Processing: Netflix_data/ratings\\mv_0013066.txt\n",
      "Processing: Netflix_data/ratings\\mv_0013080.txt\n",
      "Processing: Netflix_data/ratings\\mv_0013102.txt\n",
      "Processing: Netflix_data/ratings\\mv_0013106.txt\n",
      "Processing: Netflix_data/ratings\\mv_0013123.txt\n",
      "Processing: Netflix_data/ratings\\mv_0013136.txt\n",
      "Processing: Netflix_data/ratings\\mv_0013137.txt\n",
      "Processing: Netflix_data/ratings\\mv_0013181.txt\n",
      "Processing: Netflix_data/ratings\\mv_0013190.txt\n",
      "Processing: Netflix_data/ratings\\mv_0013218.txt\n",
      "Processing: Netflix_data/ratings\\mv_0013221.txt\n",
      "Processing: Netflix_data/ratings\\mv_0013247.txt\n",
      "Processing: Netflix_data/ratings\\mv_0013268.txt\n",
      "Processing: Netflix_data/ratings\\mv_0013269.txt\n",
      "Processing: Netflix_data/ratings\\mv_0013278.txt\n",
      "Processing: Netflix_data/ratings\\mv_0013281.txt\n",
      "Processing: Netflix_data/ratings\\mv_0013307.txt\n",
      "Processing: Netflix_data/ratings\\mv_0013333.txt\n",
      "Processing: Netflix_data/ratings\\mv_0013348.txt\n",
      "Processing: Netflix_data/ratings\\mv_0013351.txt\n",
      "Processing: Netflix_data/ratings\\mv_0013352.txt\n",
      "Processing: Netflix_data/ratings\\mv_0013366.txt\n",
      "Processing: Netflix_data/ratings\\mv_0013369.txt\n",
      "Processing: Netflix_data/ratings\\mv_0013377.txt\n",
      "Processing: Netflix_data/ratings\\mv_0013385.txt\n",
      "Processing: Netflix_data/ratings\\mv_0013390.txt\n",
      "Processing: Netflix_data/ratings\\mv_0013416.txt\n",
      "Processing: Netflix_data/ratings\\mv_0013430.txt\n",
      "Processing: Netflix_data/ratings\\mv_0013467.txt\n",
      "Processing: Netflix_data/ratings\\mv_0013468.txt\n",
      "Processing: Netflix_data/ratings\\mv_0013477.txt\n",
      "Processing: Netflix_data/ratings\\mv_0013528.txt\n",
      "Processing: Netflix_data/ratings\\mv_0013533.txt\n",
      "Processing: Netflix_data/ratings\\mv_0013539.txt\n",
      "Processing: Netflix_data/ratings\\mv_0013546.txt\n",
      "Processing: Netflix_data/ratings\\mv_0013613.txt\n",
      "Processing: Netflix_data/ratings\\mv_0013639.txt\n",
      "Processing: Netflix_data/ratings\\mv_0013653.txt\n",
      "Processing: Netflix_data/ratings\\mv_0013654.txt\n",
      "Processing: Netflix_data/ratings\\mv_0013660.txt\n",
      "Processing: Netflix_data/ratings\\mv_0013679.txt\n",
      "Processing: Netflix_data/ratings\\mv_0013684.txt\n",
      "Processing: Netflix_data/ratings\\mv_0013696.txt\n",
      "Processing: Netflix_data/ratings\\mv_0013701.txt\n",
      "Processing: Netflix_data/ratings\\mv_0013721.txt\n",
      "Processing: Netflix_data/ratings\\mv_0013777.txt\n",
      "Processing: Netflix_data/ratings\\mv_0013812.txt\n",
      "Processing: Netflix_data/ratings\\mv_0013822.txt\n",
      "Processing: Netflix_data/ratings\\mv_0013826.txt\n",
      "Processing: Netflix_data/ratings\\mv_0013842.txt\n",
      "Processing: Netflix_data/ratings\\mv_0013845.txt\n",
      "Processing: Netflix_data/ratings\\mv_0013846.txt\n",
      "Processing: Netflix_data/ratings\\mv_0013865.txt\n",
      "Processing: Netflix_data/ratings\\mv_0013897.txt\n",
      "Processing: Netflix_data/ratings\\mv_0013907.txt\n",
      "Processing: Netflix_data/ratings\\mv_0013914.txt\n",
      "Processing: Netflix_data/ratings\\mv_0013943.txt\n",
      "Processing: Netflix_data/ratings\\mv_0013953.txt\n",
      "Processing: Netflix_data/ratings\\mv_0013960.txt\n",
      "Processing: Netflix_data/ratings\\mv_0013983.txt\n",
      "Processing: Netflix_data/ratings\\mv_0014022.txt\n",
      "Processing: Netflix_data/ratings\\mv_0014045.txt\n",
      "Processing: Netflix_data/ratings\\mv_0014070.txt\n",
      "Processing: Netflix_data/ratings\\mv_0014075.txt\n",
      "Processing: Netflix_data/ratings\\mv_0014086.txt\n",
      "Processing: Netflix_data/ratings\\mv_0014111.txt\n",
      "Processing: Netflix_data/ratings\\mv_0014131.txt\n",
      "Processing: Netflix_data/ratings\\mv_0014138.txt\n",
      "Processing: Netflix_data/ratings\\mv_0014143.txt\n",
      "Processing: Netflix_data/ratings\\mv_0014147.txt\n",
      "Processing: Netflix_data/ratings\\mv_0014148.txt\n",
      "Processing: Netflix_data/ratings\\mv_0014197.txt\n",
      "Processing: Netflix_data/ratings\\mv_0014217.txt\n",
      "Processing: Netflix_data/ratings\\mv_0014223.txt\n",
      "Processing: Netflix_data/ratings\\mv_0014228.txt\n",
      "Processing: Netflix_data/ratings\\mv_0014229.txt\n",
      "Processing: Netflix_data/ratings\\mv_0014241.txt\n",
      "Processing: Netflix_data/ratings\\mv_0014248.txt\n",
      "Processing: Netflix_data/ratings\\mv_0014254.txt\n",
      "Processing: Netflix_data/ratings\\mv_0014272.txt\n",
      "Processing: Netflix_data/ratings\\mv_0014273.txt\n",
      "Processing: Netflix_data/ratings\\mv_0014277.txt\n",
      "Processing: Netflix_data/ratings\\mv_0014296.txt\n",
      "Processing: Netflix_data/ratings\\mv_0014326.txt\n",
      "Processing: Netflix_data/ratings\\mv_0014338.txt\n",
      "Processing: Netflix_data/ratings\\mv_0014370.txt\n",
      "Processing: Netflix_data/ratings\\mv_0014373.txt\n",
      "Processing: Netflix_data/ratings\\mv_0014404.txt\n",
      "Processing: Netflix_data/ratings\\mv_0014408.txt\n",
      "Processing: Netflix_data/ratings\\mv_0014458.txt\n",
      "Processing: Netflix_data/ratings\\mv_0014468.txt\n",
      "Processing: Netflix_data/ratings\\mv_0014497.txt\n",
      "Processing: Netflix_data/ratings\\mv_0014541.txt\n",
      "Processing: Netflix_data/ratings\\mv_0014550.txt\n",
      "Processing: Netflix_data/ratings\\mv_0014551.txt\n",
      "Processing: Netflix_data/ratings\\mv_0014555.txt\n",
      "Processing: Netflix_data/ratings\\mv_0014632.txt\n",
      "Processing: Netflix_data/ratings\\mv_0014645.txt\n",
      "Processing: Netflix_data/ratings\\mv_0014680.txt\n",
      "Processing: Netflix_data/ratings\\mv_0014700.txt\n",
      "Processing: Netflix_data/ratings\\mv_0014704.txt\n",
      "Processing: Netflix_data/ratings\\mv_0014719.txt\n",
      "Processing: Netflix_data/ratings\\mv_0014735.txt\n",
      "Processing: Netflix_data/ratings\\mv_0014736.txt\n",
      "Processing: Netflix_data/ratings\\mv_0014748.txt\n",
      "Processing: Netflix_data/ratings\\mv_0014789.txt\n",
      "Processing: Netflix_data/ratings\\mv_0014794.txt\n",
      "Processing: Netflix_data/ratings\\mv_0014795.txt\n",
      "Processing: Netflix_data/ratings\\mv_0014800.txt\n",
      "Processing: Netflix_data/ratings\\mv_0014823.txt\n",
      "Processing: Netflix_data/ratings\\mv_0014839.txt\n",
      "Processing: Netflix_data/ratings\\mv_0014889.txt\n",
      "Processing: Netflix_data/ratings\\mv_0014922.txt\n",
      "Processing: Netflix_data/ratings\\mv_0014927.txt\n",
      "Processing: Netflix_data/ratings\\mv_0014960.txt\n",
      "Processing: Netflix_data/ratings\\mv_0014961.txt\n",
      "Processing: Netflix_data/ratings\\mv_0014975.txt\n",
      "Processing: Netflix_data/ratings\\mv_0015065.txt\n",
      "Processing: Netflix_data/ratings\\mv_0015077.txt\n",
      "Processing: Netflix_data/ratings\\mv_0015099.txt\n",
      "Processing: Netflix_data/ratings\\mv_0015113.txt\n",
      "Processing: Netflix_data/ratings\\mv_0015117.txt\n",
      "Processing: Netflix_data/ratings\\mv_0015144.txt\n",
      "Processing: Netflix_data/ratings\\mv_0015149.txt\n",
      "Processing: Netflix_data/ratings\\mv_0015158.txt\n",
      "Processing: Netflix_data/ratings\\mv_0015161.txt\n",
      "Processing: Netflix_data/ratings\\mv_0015163.txt\n",
      "Processing: Netflix_data/ratings\\mv_0015164.txt\n",
      "Processing: Netflix_data/ratings\\mv_0015196.txt\n",
      "Processing: Netflix_data/ratings\\mv_0015223.txt\n",
      "Processing: Netflix_data/ratings\\mv_0015225.txt\n",
      "Processing: Netflix_data/ratings\\mv_0015236.txt\n",
      "Processing: Netflix_data/ratings\\mv_0015237.txt\n",
      "Processing: Netflix_data/ratings\\mv_0015238.txt\n",
      "Processing: Netflix_data/ratings\\mv_0015243.txt\n",
      "Processing: Netflix_data/ratings\\mv_0015247.txt\n",
      "Processing: Netflix_data/ratings\\mv_0015266.txt\n",
      "Processing: Netflix_data/ratings\\mv_0015281.txt\n",
      "Processing: Netflix_data/ratings\\mv_0015286.txt\n",
      "Processing: Netflix_data/ratings\\mv_0015295.txt\n",
      "Processing: Netflix_data/ratings\\mv_0015334.txt\n",
      "Processing: Netflix_data/ratings\\mv_0015358.txt\n",
      "Processing: Netflix_data/ratings\\mv_0015364.txt\n",
      "Processing: Netflix_data/ratings\\mv_0015383.txt\n",
      "Processing: Netflix_data/ratings\\mv_0015389.txt\n",
      "Processing: Netflix_data/ratings\\mv_0015392.txt\n",
      "Processing: Netflix_data/ratings\\mv_0015410.txt\n",
      "Processing: Netflix_data/ratings\\mv_0015416.txt\n",
      "Processing: Netflix_data/ratings\\mv_0015425.txt\n",
      "Processing: Netflix_data/ratings\\mv_0015440.txt\n",
      "Processing: Netflix_data/ratings\\mv_0015455.txt\n",
      "Processing: Netflix_data/ratings\\mv_0015460.txt\n",
      "Processing: Netflix_data/ratings\\mv_0015486.txt\n",
      "Processing: Netflix_data/ratings\\mv_0015488.txt\n",
      "Processing: Netflix_data/ratings\\mv_0015494.txt\n",
      "Processing: Netflix_data/ratings\\mv_0015512.txt\n",
      "Processing: Netflix_data/ratings\\mv_0015526.txt\n",
      "Processing: Netflix_data/ratings\\mv_0015539.txt\n",
      "Processing: Netflix_data/ratings\\mv_0015541.txt\n",
      "Processing: Netflix_data/ratings\\mv_0015553.txt\n",
      "Processing: Netflix_data/ratings\\mv_0015563.txt\n",
      "Processing: Netflix_data/ratings\\mv_0015575.txt\n",
      "Processing: Netflix_data/ratings\\mv_0015584.txt\n",
      "Processing: Netflix_data/ratings\\mv_0015591.txt\n",
      "Processing: Netflix_data/ratings\\mv_0015594.txt\n",
      "Processing: Netflix_data/ratings\\mv_0015620.txt\n",
      "Processing: Netflix_data/ratings\\mv_0015641.txt\n",
      "Processing: Netflix_data/ratings\\mv_0015674.txt\n",
      "Processing: Netflix_data/ratings\\mv_0015676.txt\n",
      "Processing: Netflix_data/ratings\\mv_0015699.txt\n",
      "Processing: Netflix_data/ratings\\mv_0015703.txt\n",
      "Processing: Netflix_data/ratings\\mv_0015766.txt\n",
      "Processing: Netflix_data/ratings\\mv_0015795.txt\n",
      "Processing: Netflix_data/ratings\\mv_0015800.txt\n",
      "Processing: Netflix_data/ratings\\mv_0015802.txt\n",
      "Processing: Netflix_data/ratings\\mv_0015810.txt\n",
      "Processing: Netflix_data/ratings\\mv_0015834.txt\n",
      "Processing: Netflix_data/ratings\\mv_0015851.txt\n",
      "Processing: Netflix_data/ratings\\mv_0015857.txt\n",
      "Processing: Netflix_data/ratings\\mv_0015859.txt\n",
      "Processing: Netflix_data/ratings\\mv_0015861.txt\n",
      "Processing: Netflix_data/ratings\\mv_0015881.txt\n",
      "Processing: Netflix_data/ratings\\mv_0015893.txt\n",
      "Processing: Netflix_data/ratings\\mv_0015898.txt\n",
      "Processing: Netflix_data/ratings\\mv_0015901.txt\n",
      "Processing: Netflix_data/ratings\\mv_0015935.txt\n",
      "Processing: Netflix_data/ratings\\mv_0015961.txt\n",
      "Processing: Netflix_data/ratings\\mv_0016023.txt\n",
      "Processing: Netflix_data/ratings\\mv_0016071.txt\n",
      "Processing: Netflix_data/ratings\\mv_0016101.txt\n",
      "Processing: Netflix_data/ratings\\mv_0016103.txt\n",
      "Processing: Netflix_data/ratings\\mv_0016124.txt\n",
      "Processing: Netflix_data/ratings\\mv_0016128.txt\n",
      "Processing: Netflix_data/ratings\\mv_0016142.txt\n",
      "Processing: Netflix_data/ratings\\mv_0016143.txt\n",
      "Processing: Netflix_data/ratings\\mv_0016177.txt\n",
      "Processing: Netflix_data/ratings\\mv_0016180.txt\n",
      "Processing: Netflix_data/ratings\\mv_0016199.txt\n",
      "Processing: Netflix_data/ratings\\mv_0016235.txt\n",
      "Processing: Netflix_data/ratings\\mv_0016257.txt\n",
      "Processing: Netflix_data/ratings\\mv_0016289.txt\n",
      "Processing: Netflix_data/ratings\\mv_0016293.txt\n",
      "Processing: Netflix_data/ratings\\mv_0016311.txt\n",
      "Processing: Netflix_data/ratings\\mv_0016319.txt\n",
      "Processing: Netflix_data/ratings\\mv_0016321.txt\n",
      "Processing: Netflix_data/ratings\\mv_0016335.txt\n",
      "Processing: Netflix_data/ratings\\mv_0016349.txt\n",
      "Processing: Netflix_data/ratings\\mv_0016362.txt\n",
      "Processing: Netflix_data/ratings\\mv_0016373.txt\n",
      "Processing: Netflix_data/ratings\\mv_0016378.txt\n",
      "Processing: Netflix_data/ratings\\mv_0016390.txt\n",
      "Processing: Netflix_data/ratings\\mv_0016394.txt\n",
      "Processing: Netflix_data/ratings\\mv_0016445.txt\n",
      "Processing: Netflix_data/ratings\\mv_0016460.txt\n",
      "Processing: Netflix_data/ratings\\mv_0016505.txt\n",
      "Processing: Netflix_data/ratings\\mv_0016507.txt\n",
      "Processing: Netflix_data/ratings\\mv_0016524.txt\n",
      "Processing: Netflix_data/ratings\\mv_0016573.txt\n",
      "Processing: Netflix_data/ratings\\mv_0016575.txt\n",
      "Processing: Netflix_data/ratings\\mv_0016610.txt\n",
      "Processing: Netflix_data/ratings\\mv_0016614.txt\n",
      "Processing: Netflix_data/ratings\\mv_0016625.txt\n",
      "Processing: Netflix_data/ratings\\mv_0016627.txt\n",
      "Processing: Netflix_data/ratings\\mv_0016645.txt\n",
      "Processing: Netflix_data/ratings\\mv_0016650.txt\n",
      "Processing: Netflix_data/ratings\\mv_0016666.txt\n",
      "Processing: Netflix_data/ratings\\mv_0016693.txt\n",
      "Processing: Netflix_data/ratings\\mv_0016701.txt\n",
      "Processing: Netflix_data/ratings\\mv_0016705.txt\n",
      "Processing: Netflix_data/ratings\\mv_0016720.txt\n",
      "Processing: Netflix_data/ratings\\mv_0016740.txt\n",
      "Processing: Netflix_data/ratings\\mv_0016783.txt\n",
      "Processing: Netflix_data/ratings\\mv_0016786.txt\n",
      "Processing: Netflix_data/ratings\\mv_0016790.txt\n",
      "Processing: Netflix_data/ratings\\mv_0016812.txt\n",
      "Processing: Netflix_data/ratings\\mv_0016815.txt\n",
      "Processing: Netflix_data/ratings\\mv_0016817.txt\n",
      "Processing: Netflix_data/ratings\\mv_0016821.txt\n",
      "Processing: Netflix_data/ratings\\mv_0016827.txt\n",
      "Processing: Netflix_data/ratings\\mv_0016842.txt\n",
      "Processing: Netflix_data/ratings\\mv_0016844.txt\n",
      "Processing: Netflix_data/ratings\\mv_0016859.txt\n",
      "Processing: Netflix_data/ratings\\mv_0016869.txt\n",
      "Processing: Netflix_data/ratings\\mv_0016877.txt\n",
      "Processing: Netflix_data/ratings\\mv_0016898.txt\n",
      "Processing: Netflix_data/ratings\\mv_0016901.txt\n",
      "Processing: Netflix_data/ratings\\mv_0016906.txt\n",
      "Processing: Netflix_data/ratings\\mv_0016914.txt\n",
      "Processing: Netflix_data/ratings\\mv_0016938.txt\n",
      "Processing: Netflix_data/ratings\\mv_0017014.txt\n",
      "Processing: Netflix_data/ratings\\mv_0017015.txt\n",
      "Processing: Netflix_data/ratings\\mv_0017029.txt\n",
      "Processing: Netflix_data/ratings\\mv_0017042.txt\n",
      "Processing: Netflix_data/ratings\\mv_0017049.txt\n",
      "Processing: Netflix_data/ratings\\mv_0017094.txt\n",
      "Processing: Netflix_data/ratings\\mv_0017138.txt\n",
      "Processing: Netflix_data/ratings\\mv_0017146.txt\n",
      "Processing: Netflix_data/ratings\\mv_0017147.txt\n",
      "Processing: Netflix_data/ratings\\mv_0017159.txt\n",
      "Processing: Netflix_data/ratings\\mv_0017176.txt\n",
      "Processing: Netflix_data/ratings\\mv_0017183.txt\n",
      "Processing: Netflix_data/ratings\\mv_0017196.txt\n",
      "Processing: Netflix_data/ratings\\mv_0017219.txt\n",
      "Processing: Netflix_data/ratings\\mv_0017232.txt\n",
      "Processing: Netflix_data/ratings\\mv_0017234.txt\n",
      "Processing: Netflix_data/ratings\\mv_0017242.txt\n",
      "Processing: Netflix_data/ratings\\mv_0017243.txt\n",
      "Processing: Netflix_data/ratings\\mv_0017249.txt\n",
      "Processing: Netflix_data/ratings\\mv_0017250.txt\n",
      "Processing: Netflix_data/ratings\\mv_0017251.txt\n",
      "Processing: Netflix_data/ratings\\mv_0017297.txt\n",
      "Processing: Netflix_data/ratings\\mv_0017311.txt\n",
      "Processing: Netflix_data/ratings\\mv_0017315.txt\n",
      "Processing: Netflix_data/ratings\\mv_0017330.txt\n",
      "Processing: Netflix_data/ratings\\mv_0017333.txt\n",
      "Processing: Netflix_data/ratings\\mv_0017337.txt\n",
      "Processing: Netflix_data/ratings\\mv_0017341.txt\n",
      "Processing: Netflix_data/ratings\\mv_0017349.txt\n",
      "Processing: Netflix_data/ratings\\mv_0017398.txt\n",
      "Processing: Netflix_data/ratings\\mv_0017407.txt\n",
      "Processing: Netflix_data/ratings\\mv_0017429.txt\n",
      "Processing: Netflix_data/ratings\\mv_0017432.txt\n",
      "Processing: Netflix_data/ratings\\mv_0017443.txt\n",
      "Processing: Netflix_data/ratings\\mv_0017462.txt\n",
      "Processing: Netflix_data/ratings\\mv_0017465.txt\n",
      "Processing: Netflix_data/ratings\\mv_0017487.txt\n",
      "Processing: Netflix_data/ratings\\mv_0017497.txt\n",
      "Processing: Netflix_data/ratings\\mv_0017498.txt\n",
      "Processing: Netflix_data/ratings\\mv_0017510.txt\n",
      "Processing: Netflix_data/ratings\\mv_0017514.txt\n",
      "Processing: Netflix_data/ratings\\mv_0017518.txt\n",
      "Processing: Netflix_data/ratings\\mv_0017522.txt\n",
      "Processing: Netflix_data/ratings\\mv_0017559.txt\n",
      "Processing: Netflix_data/ratings\\mv_0017603.txt\n",
      "Processing: Netflix_data/ratings\\mv_0017604.txt\n",
      "Processing: Netflix_data/ratings\\mv_0017613.txt\n",
      "Processing: Netflix_data/ratings\\mv_0017627.txt\n",
      "Processing: Netflix_data/ratings\\mv_0017643.txt\n",
      "Processing: Netflix_data/ratings\\mv_0017665.txt\n",
      "Processing: Netflix_data/ratings\\mv_0017668.txt\n",
      "Processing: Netflix_data/ratings\\mv_0017670.txt\n",
      "Processing: Netflix_data/ratings\\mv_0017695.txt\n",
      "Processing: Netflix_data/ratings\\mv_0017721.txt\n",
      "Processing: Netflix_data/ratings\\mv_0017723.txt\n",
      "Processing: Netflix_data/ratings\\mv_0017733.txt\n",
      "Processing: Netflix_data/ratings\\mv_0017752.txt\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "STATS FOR ALL INPUT DATA\n",
      "STATS\n",
      "Total Ratings: 5974565\n",
      "Total User count: 436746\n",
      "Netflix full train\n",
      "STATS\n",
      "Total Ratings: 5835300\n",
      "Total User count: 430576\n",
      "Netflix full valid\n",
      "STATS\n",
      "Total Ratings: 57277\n",
      "Total User count: 28871\n",
      "Netflix full test\n",
      "STATS\n",
      "Total Ratings: 57538\n",
      "Total User count: 28958\n",
      "Netflix 3m train\n",
      "STATS\n",
      "Total Ratings: 786865\n",
      "Total User count: 173559\n",
      "Netflix 3m valid\n",
      "STATS\n",
      "Total Ratings: 45483\n",
      "Total User count: 22190\n",
      "Netflix 3m test\n",
      "STATS\n",
      "Total Ratings: 45611\n",
      "Total User count: 22141\n",
      "Netflix 6m train\n",
      "STATS\n",
      "Total Ratings: 1691351\n",
      "Total User count: 280741\n",
      "Netflix 6m valid\n",
      "STATS\n",
      "Total Ratings: 52781\n",
      "Total User count: 26348\n",
      "Netflix 6m test\n",
      "STATS\n",
      "Total Ratings: 52880\n",
      "Total User count: 26295\n",
      "Netflix 1y train\n",
      "STATS\n",
      "Total Ratings: 2406508\n",
      "Total User count: 271348\n",
      "Netflix 1y valid\n",
      "STATS\n",
      "Total Ratings: 90332\n",
      "Total User count: 44875\n",
      "Netflix 1y test\n",
      "STATS\n",
      "Total Ratings: 90613\n",
      "Total User count: 45288\n"
     ]
    }
   ],
   "source": [
    "!python netflix_data_convert.py Netflix_data/ratings Netflix_data/output"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<font color=red>上面命令行中的ratings文件夹现在为压缩包形式，使用前需先进行解压</font>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "TRAIN = 'Netflix_data/output/N3M_TRAIN'\n",
    "EVAL = 'Netflix_data/output/N3M_VALID'\n",
    "TEST = 'Netflix_data/output/N3M_TEST'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>CustomerID</th>\n",
       "      <th>MovieID</th>\n",
       "      <th>Rating</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>6</td>\n",
       "      <td>1062</td>\n",
       "      <td>3.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>8</td>\n",
       "      <td>399</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>8</td>\n",
       "      <td>579</td>\n",
       "      <td>3.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>12</td>\n",
       "      <td>729</td>\n",
       "      <td>2.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>13</td>\n",
       "      <td>631</td>\n",
       "      <td>4.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   CustomerID MovieID  Rating\n",
       "0           6    1062     3.0\n",
       "1           8     399     5.0\n",
       "2           8     579     3.0\n",
       "3          12     729     2.0\n",
       "4          13     631     4.0"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "nf_3m_test = os.path.join(TEST,'n3m.test.txt')\n",
    "df = pd.read_csv(nf_3m_test, names=['CustomerID','MovieID','Rating'],dtype={'MovieID':np.object}, sep='\\t')\n",
    "df.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 模型训练与评估"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 1. 设置参数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# Autoencoder parameters\n",
    "GPUS = 0 #'0,1,2,3'\n",
    "ACTIVATION = 'selu'\n",
    "OPTIMIZER = 'momentum'\n",
    "HIDDEN = '512,512,1024'\n",
    "BATCH_SIZE = 128\n",
    "DROPOUT = 0.8\n",
    "LR = 0.005\n",
    "WD = 0\n",
    "EPOCHS = 10\n",
    "AUG_STEP = 1\n",
    "MODEL_OUTPUT_DIR = 'model_save'\n",
    "\n",
    "# Evaluation\n",
    "INFER_OUTPUT = 'preds.txt'\n",
    "MODEL_PATH = os.path.join(MODEL_OUTPUT_DIR, 'model.epoch_' + str(EPOCHS-1))\n",
    "MOVIE_TITLES = 'Netflix_data/movie_titles.txt'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 2. 开始训练"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<font color=red>模型已训练好，无需再次运行</font>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "D:\\ProgramData\\Anaconda3\\lib\\site-packages\\tensorflow\\python\\framework\\dtypes.py:469: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.\n",
      "  _np_qint8 = np.dtype([(\"qint8\", np.int8, 1)])\n",
      "D:\\ProgramData\\Anaconda3\\lib\\site-packages\\tensorflow\\python\\framework\\dtypes.py:470: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.\n",
      "  _np_quint8 = np.dtype([(\"quint8\", np.uint8, 1)])\n",
      "D:\\ProgramData\\Anaconda3\\lib\\site-packages\\tensorflow\\python\\framework\\dtypes.py:471: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.\n",
      "  _np_qint16 = np.dtype([(\"qint16\", np.int16, 1)])\n",
      "D:\\ProgramData\\Anaconda3\\lib\\site-packages\\tensorflow\\python\\framework\\dtypes.py:472: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.\n",
      "  _np_quint16 = np.dtype([(\"quint16\", np.uint16, 1)])\n",
      "D:\\ProgramData\\Anaconda3\\lib\\site-packages\\tensorflow\\python\\framework\\dtypes.py:473: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.\n",
      "  _np_qint32 = np.dtype([(\"qint32\", np.int32, 1)])\n",
      "D:\\ProgramData\\Anaconda3\\lib\\site-packages\\tensorflow\\python\\framework\\dtypes.py:476: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.\n",
      "  np_resource = np.dtype([(\"resource\", np.ubyte, 1)])\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Namespace(aug_step=1, batch_size=128, constrained=False, drop_prob=0.8, gpu_ids='0', hidden_layers='512,512,1024', logdir='model_save', lr=0.005, noise_prob=0.0, non_linearity_type='selu', num_epochs=10, optimizer='momentum', path_to_eval_data='Netflix_data/output/N3M_VALID', path_to_train_data='Netflix_data/output/N3M_TRAIN', skip_last_layer_nl=False, summary_frequency=100, weight_decay=0.0)\n",
      "GPU is not available.\n",
      "Loading training data\n",
      "Data loaded\n",
      "Total items found: 173559\n",
      "Vector dim: 1106\n",
      "Loading eval data\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "E:\\工作\\课程\\特训营\\电商推荐系统\\recommender_system\\Online\\lesson3\\PyTorch\\reco_encoder\\model\\model.py:60: UserWarning: nn.init.xavier_uniform is now deprecated in favor of nn.init.xavier_uniform_.\n",
      "  weight_init.xavier_uniform(w)\n",
      "E:\\工作\\课程\\特训营\\电商推荐系统\\recommender_system\\Online\\lesson3\\PyTorch\\reco_encoder\\model\\model.py:72: UserWarning: nn.init.xavier_uniform is now deprecated in favor of nn.init.xavier_uniform_.\n",
      "  weight_init.xavier_uniform(w)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "******************************\n",
      "******************************\n",
      "[1106, 512, 512, 1024]\n",
      "Dropout drop probability: 0.8\n",
      "Encoder pass:\n",
      "torch.Size([512, 1106])\n",
      "torch.Size([512])\n",
      "torch.Size([512, 512])\n",
      "torch.Size([512])\n",
      "torch.Size([1024, 512])\n",
      "torch.Size([1024])\n",
      "Decoder pass:\n",
      "torch.Size([512, 1024])\n",
      "torch.Size([512])\n",
      "torch.Size([512, 512])\n",
      "torch.Size([512])\n",
      "torch.Size([1106, 512])\n",
      "torch.Size([1106])\n",
      "******************************\n",
      "******************************\n",
      "######################################################\n",
      "######################################################\n",
      "############# AutoEncoder Model: #####################\n",
      "AutoEncoder(\n",
      "  (drop): Dropout(p=0.8)\n",
      "  (encode_w): ParameterList(\n",
      "      (0): Parameter containing: [torch.FloatTensor of size 512x1106]\n",
      "      (1): Parameter containing: [torch.FloatTensor of size 512x512]\n",
      "      (2): Parameter containing: [torch.FloatTensor of size 1024x512]\n",
      "    \n",
      "  )\n",
      "  (encode_b): ParameterList(\n",
      "      (0): Parameter containing: [torch.FloatTensor of size 512]\n",
      "      (1): Parameter containing: [torch.FloatTensor of size 512]\n",
      "      (2): Parameter containing: [torch.FloatTensor of size 1024]\n",
      "    \n",
      "  )\n",
      "  (decode_w): ParameterList(\n",
      "      (0): Parameter containing: [torch.FloatTensor of size 512x1024]\n",
      "      (1): Parameter containing: [torch.FloatTensor of size 512x512]\n",
      "      (2): Parameter containing: [torch.FloatTensor of size 1106x512]\n",
      "    \n",
      "  )\n",
      "  (decode_b): ParameterList(\n",
      "      (0): Parameter containing: [torch.FloatTensor of size 512]\n",
      "      (1): Parameter containing: [torch.FloatTensor of size 512]\n",
      "      (2): Parameter containing: [torch.FloatTensor of size 1106]\n",
      "    \n",
      "  )\n",
      ")\n",
      "######################################################\n",
      "######################################################\n",
      "Using GPUs: [0]\n",
      "Doing epoch 0 of 10\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "E:\\工作\\课程\\特训营\\电商推荐系统\\recommender_system\\Online\\lesson3\\PyTorch\\run.py:196: UserWarning: invalid index of a 0-dim tensor. This will be an error in PyTorch 0.5. Use tensor.item() to convert a 0-dim tensor to a Python number\n",
      "  t_loss += loss.data[0]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[0,     0] RMSE: 3.9898903\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "E:\\工作\\课程\\特训营\\电商推荐系统\\recommender_system\\Online\\lesson3\\PyTorch\\run.py:210: UserWarning: invalid index of a 0-dim tensor. This will be an error in PyTorch 0.5. Use tensor.item() to convert a 0-dim tensor to a Python number\n",
      "  total_epoch_loss += loss.data[0]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[0,   100] RMSE: 1.7303204\n",
      "[0,   200] RMSE: 1.1430737\n",
      "[0,   300] RMSE: 1.0526411\n",
      "[0,   400] RMSE: 1.0050501\n",
      "[0,   500] RMSE: 0.9690841\n",
      "[0,   600] RMSE: 0.9697021\n",
      "[0,   700] RMSE: 0.9311695\n",
      "[0,   800] RMSE: 0.9246207\n",
      "[0,   900] RMSE: 0.9217271\n",
      "[0,  1000] RMSE: 0.9107654\n",
      "[0,  1100] RMSE: 0.9029777\n",
      "[0,  1200] RMSE: 0.8939253\n",
      "[0,  1300] RMSE: 0.8775005\n",
      "Total epoch 0 finished in 228.30405855178833 seconds with TRAINING RMSE loss: 1.0395551388471373\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "E:\\工作\\课程\\特训营\\电商推荐系统\\recommender_system\\Online\\lesson3\\PyTorch\\run.py:72: UserWarning: invalid index of a 0-dim tensor. This will be an error in PyTorch 0.5. Use tensor.item() to convert a 0-dim tensor to a Python number\n",
      "  total_epoch_loss += loss.data[0]\n",
      "E:\\工作\\课程\\特训营\\电商推荐系统\\recommender_system\\Online\\lesson3\\PyTorch\\run.py:73: UserWarning: invalid index of a 0-dim tensor. This will be an error in PyTorch 0.5. Use tensor.item() to convert a 0-dim tensor to a Python number\n",
      "  denom += num_ratings.data[0]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Epoch 0 EVALUATION LOSS: 1.8925109788382188\n",
      "Saving model to model_save/model.epoch_0\n",
      "Doing epoch 1 of 10\n",
      "[1,     0] RMSE: 0.8598430\n",
      "[1,   100] RMSE: 0.8506381\n",
      "[1,   200] RMSE: 0.8484050\n",
      "[1,   300] RMSE: 0.8413375\n",
      "[1,   400] RMSE: 0.8481489\n",
      "[1,   500] RMSE: 0.8276425\n",
      "[1,   600] RMSE: 0.8291753\n",
      "[1,   700] RMSE: 0.8208077\n",
      "[1,   800] RMSE: 0.8240229\n",
      "[1,   900] RMSE: 0.8338989\n",
      "[1,  1000] RMSE: 0.8101237\n",
      "[1,  1100] RMSE: 0.8132584\n",
      "[1,  1200] RMSE: 0.8153033\n",
      "[1,  1300] RMSE: 0.8072152\n",
      "Total epoch 1 finished in 226.33594584465027 seconds with TRAINING RMSE loss: 0.8282605546093988\n",
      "Doing epoch 2 of 10\n",
      "[2,     0] RMSE: 0.8207490\n",
      "[2,   100] RMSE: 0.7933994\n",
      "[2,   200] RMSE: 0.7851581\n",
      "[2,   300] RMSE: 0.7882614\n",
      "[2,   400] RMSE: 0.7932630\n",
      "[2,   500] RMSE: 0.7945206\n",
      "[2,   600] RMSE: 0.7790330\n",
      "[2,   700] RMSE: 0.7764686\n",
      "[2,   800] RMSE: 0.7807144\n",
      "[2,   900] RMSE: 0.7759949\n",
      "[2,  1000] RMSE: 0.7735806\n",
      "[2,  1100] RMSE: 0.7768570\n",
      "[2,  1200] RMSE: 0.7805676\n",
      "[2,  1300] RMSE: 0.7710443\n",
      "Total epoch 2 finished in 237.2345688343048 seconds with TRAINING RMSE loss: 0.7816361045420728\n",
      "Doing epoch 3 of 10\n",
      "[3,     0] RMSE: 0.7652755\n",
      "[3,   100] RMSE: 0.7568268\n",
      "[3,   200] RMSE: 0.7581006\n",
      "[3,   300] RMSE: 0.7501815\n",
      "[3,   400] RMSE: 0.7466722\n",
      "[3,   500] RMSE: 0.7523250\n",
      "[3,   600] RMSE: 0.7523969\n",
      "[3,   700] RMSE: 0.7511909\n",
      "[3,   800] RMSE: 0.7554479\n",
      "[3,   900] RMSE: 0.7551554\n",
      "[3,  1000] RMSE: 0.7458122\n",
      "[3,  1100] RMSE: 0.7526062\n",
      "[3,  1200] RMSE: 0.7487053\n",
      "[3,  1300] RMSE: 0.7370735\n",
      "Total epoch 3 finished in 225.86791896820068 seconds with TRAINING RMSE loss: 0.7506816468474737\n",
      "Epoch 3 EVALUATION LOSS: 2.4031542395510668\n",
      "Saving model to model_save/model.epoch_3\n",
      "Doing epoch 4 of 10\n",
      "[4,     0] RMSE: 0.7446002\n",
      "[4,   100] RMSE: 0.7296868\n",
      "[4,   200] RMSE: 0.7299583\n",
      "[4,   300] RMSE: 0.7280038\n",
      "[4,   400] RMSE: 0.7349710\n",
      "[4,   500] RMSE: 0.7296618\n",
      "[4,   600] RMSE: 0.7279734\n",
      "[4,   700] RMSE: 0.7332564\n",
      "[4,   800] RMSE: 0.7291331\n",
      "[4,   900] RMSE: 0.7282425\n",
      "[4,  1000] RMSE: 0.7241777\n",
      "[4,  1100] RMSE: 0.7261190\n",
      "[4,  1200] RMSE: 0.7241939\n",
      "[4,  1300] RMSE: 0.7284679\n",
      "Total epoch 4 finished in 254.9515824317932 seconds with TRAINING RMSE loss: 0.7288533264114605\n",
      "Doing epoch 5 of 10\n",
      "[5,     0] RMSE: 0.7313031\n",
      "[5,   100] RMSE: 0.7090615\n",
      "[5,   200] RMSE: 0.7103144\n",
      "[5,   300] RMSE: 0.7075916\n",
      "[5,   400] RMSE: 0.7138548\n",
      "[5,   500] RMSE: 0.7078968\n",
      "[5,   600] RMSE: 0.7043051\n",
      "[5,   700] RMSE: 0.7117723\n",
      "[5,   800] RMSE: 0.7055481\n",
      "[5,   900] RMSE: 0.7122426\n",
      "[5,  1000] RMSE: 0.7187519\n",
      "[5,  1100] RMSE: 0.7134290\n",
      "[5,  1200] RMSE: 0.7114747\n",
      "[5,  1300] RMSE: 0.7148601\n",
      "Total epoch 5 finished in 234.28940057754517 seconds with TRAINING RMSE loss: 0.711030681498053\n",
      "Doing epoch 6 of 10\n",
      "[6,     0] RMSE: 0.7127586\n",
      "[6,   100] RMSE: 0.7043045\n",
      "[6,   200] RMSE: 0.6914391\n",
      "[6,   300] RMSE: 0.6959685\n",
      "[6,   400] RMSE: 0.6961632\n",
      "[6,   500] RMSE: 0.6920129\n",
      "[6,   600] RMSE: 0.6978550\n",
      "[6,   700] RMSE: 0.6985882\n",
      "[6,   800] RMSE: 0.7053491\n",
      "[6,   900] RMSE: 0.6945429\n",
      "[6,  1000] RMSE: 0.6853394\n",
      "[6,  1100] RMSE: 0.7021151\n",
      "[6,  1200] RMSE: 0.6976584\n",
      "[6,  1300] RMSE: 0.6925880\n",
      "Total epoch 6 finished in 220.93663692474365 seconds with TRAINING RMSE loss: 0.6966602037174137\n",
      "Epoch 6 EVALUATION LOSS: 2.435084393113905\n",
      "Saving model to model_save/model.epoch_6\n",
      "Doing epoch 7 of 10\n",
      "[7,     0] RMSE: 0.7015601\n",
      "[7,   100] RMSE: 0.6868288\n",
      "[7,   200] RMSE: 0.6787026\n",
      "[7,   300] RMSE: 0.6929548\n",
      "[7,   400] RMSE: 0.6831270\n",
      "[7,   500] RMSE: 0.6839113\n",
      "[7,   600] RMSE: 0.6899749\n",
      "[7,   700] RMSE: 0.6824696\n",
      "[7,   800] RMSE: 0.6848668\n",
      "[7,   900] RMSE: 0.6855688\n",
      "[7,  1000] RMSE: 0.6808406\n",
      "[7,  1100] RMSE: 0.6779610\n",
      "[7,  1200] RMSE: 0.6904262\n",
      "[7,  1300] RMSE: 0.6842088\n",
      "Total epoch 7 finished in 216.34037399291992 seconds with TRAINING RMSE loss: 0.6851390701628115\n",
      "Doing epoch 8 of 10\n",
      "[8,     0] RMSE: 0.6926586\n",
      "[8,   100] RMSE: 0.6767095\n",
      "[8,   200] RMSE: 0.6738573\n",
      "[8,   300] RMSE: 0.6744770\n",
      "[8,   400] RMSE: 0.6734531\n",
      "[8,   500] RMSE: 0.6755038\n",
      "[8,   600] RMSE: 0.6741556\n",
      "[8,   700] RMSE: 0.6776202\n",
      "[8,   800] RMSE: 0.6704049\n",
      "[8,   900] RMSE: 0.6810085\n",
      "[8,  1000] RMSE: 0.6751173\n",
      "[8,  1100] RMSE: 0.6698217\n",
      "[8,  1200] RMSE: 0.6850912\n",
      "[8,  1300] RMSE: 0.6805773\n",
      "Total epoch 8 finished in 236.85354709625244 seconds with TRAINING RMSE loss: 0.6761312515511407\n",
      "Doing epoch 9 of 10\n",
      "[9,     0] RMSE: 0.6798108\n",
      "[9,   100] RMSE: 0.6651038\n",
      "[9,   200] RMSE: 0.6706319\n",
      "[9,   300] RMSE: 0.6594444\n",
      "[9,   400] RMSE: 0.6709939\n",
      "[9,   500] RMSE: 0.6625210\n",
      "[9,   600] RMSE: 0.6734511\n",
      "[9,   700] RMSE: 0.6668599\n",
      "[9,   800] RMSE: 0.6677742\n",
      "[9,   900] RMSE: 0.6573939\n",
      "[9,  1000] RMSE: 0.6726556\n",
      "[9,  1100] RMSE: 0.6617689\n",
      "[9,  1200] RMSE: 0.6695755\n",
      "[9,  1300] RMSE: 0.6716197\n",
      "Total epoch 9 finished in 231.4092357158661 seconds with TRAINING RMSE loss: 0.6668876688932743\n",
      "Epoch 9 EVALUATION LOSS: 2.4929062336082737\n",
      "Saving model to model_save/model.epoch_9\n",
      "Saving model to model_save/model.last\n"
     ]
    }
   ],
   "source": [
    "%run run.py --gpu_ids $GPUS \\\n",
    "    --path_to_train_data $TRAIN \\\n",
    "    --path_to_eval_data $EVAL \\\n",
    "    --hidden_layers $HIDDEN \\\n",
    "    --non_linearity_type $ACTIVATION \\\n",
    "    --batch_size $BATCH_SIZE \\\n",
    "    --logdir $MODEL_OUTPUT_DIR \\\n",
    "    --drop_prob $DROPOUT \\\n",
    "    --optimizer $OPTIMIZER \\\n",
    "    --lr $LR \\\n",
    "    --weight_decay $WD \\\n",
    "    --aug_step $AUG_STEP \\\n",
    "    --num_epochs $EPOCHS "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 3. 评估"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "接下来我们要在测试集上进行评估<font color=red>（无需再次运行）</font>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Namespace(constrained=False, drop_prob=0.8, hidden_layers='512,512,1024', non_linearity_type='selu', path_to_eval_data='Netflix_data/output/N3M_TEST', path_to_train_data='Netflix_data/output/N3M_TRAIN', predictions_path='preds.txt', save_path='model_save\\\\model.epoch_9', skip_last_layer_nl=False)\n",
      "GPU is not available.\n",
      "Loading training data\n",
      "Data loaded\n",
      "Total items found: 173559\n",
      "Vector dim: 1106\n",
      "Loading eval data\n",
      "******************************\n",
      "******************************\n",
      "[1106, 512, 512, 1024]\n",
      "Dropout drop probability: 0.8\n",
      "Encoder pass:\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "E:\\工作\\课程\\特训营\\电商推荐系统\\recommender_system\\Online\\lesson3\\PyTorch\\reco_encoder\\model\\model.py:60: UserWarning: nn.init.xavier_uniform is now deprecated in favor of nn.init.xavier_uniform_.\n",
      "  weight_init.xavier_uniform(w)\n",
      "E:\\工作\\课程\\特训营\\电商推荐系统\\recommender_system\\Online\\lesson3\\PyTorch\\reco_encoder\\model\\model.py:72: UserWarning: nn.init.xavier_uniform is now deprecated in favor of nn.init.xavier_uniform_.\n",
      "  weight_init.xavier_uniform(w)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "torch.Size([512, 1106])\n",
      "torch.Size([512])\n",
      "torch.Size([512, 512])\n",
      "torch.Size([512])\n",
      "torch.Size([1024, 512])\n",
      "torch.Size([1024])\n",
      "Decoder pass:\n",
      "torch.Size([512, 1024])\n",
      "torch.Size([512])\n",
      "torch.Size([512, 512])\n",
      "torch.Size([512])\n",
      "torch.Size([1106, 512])\n",
      "torch.Size([1106])\n",
      "******************************\n",
      "******************************\n",
      "Loading model from: model_save\\model.epoch_9\n",
      "######################################################\n",
      "######################################################\n",
      "############# AutoEncoder Model: #####################\n",
      "AutoEncoder(\n",
      "  (drop): Dropout(p=0.8)\n",
      "  (encode_w): ParameterList(\n",
      "      (0): Parameter containing: [torch.FloatTensor of size 512x1106]\n",
      "      (1): Parameter containing: [torch.FloatTensor of size 512x512]\n",
      "      (2): Parameter containing: [torch.FloatTensor of size 1024x512]\n",
      "    \n",
      "  )\n",
      "  (encode_b): ParameterList(\n",
      "      (0): Parameter containing: [torch.FloatTensor of size 512]\n",
      "      (1): Parameter containing: [torch.FloatTensor of size 512]\n",
      "      (2): Parameter containing: [torch.FloatTensor of size 1024]\n",
      "    \n",
      "  )\n",
      "  (decode_w): ParameterList(\n",
      "      (0): Parameter containing: [torch.FloatTensor of size 512x1024]\n",
      "      (1): Parameter containing: [torch.FloatTensor of size 512x512]\n",
      "      (2): Parameter containing: [torch.FloatTensor of size 1106x512]\n",
      "    \n",
      "  )\n",
      "  (decode_b): ParameterList(\n",
      "      (0): Parameter containing: [torch.FloatTensor of size 512]\n",
      "      (1): Parameter containing: [torch.FloatTensor of size 512]\n",
      "      (2): Parameter containing: [torch.FloatTensor of size 1106]\n",
      "    \n",
      "  )\n",
      ")\n",
      "######################################################\n",
      "######################################################\n",
      "Done: 0\n",
      "Done: 10000\n",
      "Done: 20000\n"
     ]
    }
   ],
   "source": [
    "%run infer.py \\\n",
    "--path_to_train_data $TRAIN \\\n",
    "--path_to_eval_data $TEST \\\n",
    "--hidden_layers $HIDDEN \\\n",
    "--non_linearity_type $ACTIVATION \\\n",
    "--save_path  $MODEL_PATH \\\n",
    "--drop_prob $DROPOUT \\\n",
    "--predictions_path $INFER_OUTPUT"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Namespace(path_to_predictions='preds.txt', round=False)\n",
      "####################\n",
      "RMSE: 2.494566718354876\n",
      "####################\n"
     ]
    }
   ],
   "source": [
    "%run compute_RMSE.py --path_to_predictions=$INFER_OUTPUT"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## API\n",
    "\n",
    "接下来我们来构建一个推荐系统的API，第一步是把用户信息取过来转成一个json的请求。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>MovieID</th>\n",
       "      <th>Year</th>\n",
       "      <th>Title</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>2003.0</td>\n",
       "      <td>Dinosaur Planet</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>2004.0</td>\n",
       "      <td>Isle of Man TT 2004 Review</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>1997.0</td>\n",
       "      <td>Character</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4</td>\n",
       "      <td>1994.0</td>\n",
       "      <td>Paula Abdul's Get Up &amp; Dance</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5</td>\n",
       "      <td>2004.0</td>\n",
       "      <td>The Rise and Fall of ECW</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   MovieID    Year                         Title\n",
       "0        1  2003.0               Dinosaur Planet\n",
       "1        2  2004.0    Isle of Man TT 2004 Review\n",
       "2        3  1997.0                     Character\n",
       "3        4  1994.0  Paula Abdul's Get Up & Dance\n",
       "4        5  2004.0      The Rise and Fall of ECW"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "titles = pd.read_csv(MOVIE_TITLES, names=['MovieID','Year','Title'])\n",
    "titles.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>CustomerID</th>\n",
       "      <th>MovieID</th>\n",
       "      <th>Rating</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>84</td>\n",
       "      <td>58</td>\n",
       "      <td>3.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>84</td>\n",
       "      <td>837</td>\n",
       "      <td>4.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>84</td>\n",
       "      <td>319</td>\n",
       "      <td>3.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>84</td>\n",
       "      <td>783</td>\n",
       "      <td>3.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>84</td>\n",
       "      <td>1011</td>\n",
       "      <td>3.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>84</td>\n",
       "      <td>48</td>\n",
       "      <td>3.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    CustomerID MovieID  Rating\n",
       "10          84      58     3.0\n",
       "11          84     837     4.0\n",
       "12          84     319     3.0\n",
       "13          84     783     3.0\n",
       "14          84    1011     3.0\n",
       "15          84      48     3.0"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "target = df[df['CustomerID'] == 84]\n",
    "target"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>CustomerID</th>\n",
       "      <th>MovieID</th>\n",
       "      <th>Rating</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>84</td>\n",
       "      <td>58</td>\n",
       "      <td>3.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>84</td>\n",
       "      <td>837</td>\n",
       "      <td>4.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>84</td>\n",
       "      <td>319</td>\n",
       "      <td>3.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>84</td>\n",
       "      <td>783</td>\n",
       "      <td>3.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>84</td>\n",
       "      <td>1011</td>\n",
       "      <td>3.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>84</td>\n",
       "      <td>48</td>\n",
       "      <td>3.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   CustomerID MovieID  Rating\n",
       "0          84      58     3.0\n",
       "1          84     837     4.0\n",
       "2          84     319     3.0\n",
       "3          84     783     3.0\n",
       "4          84    1011     3.0\n",
       "5          84      48     3.0"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_customer = pd.merge(target, titles, on='MovieID', how='left')\n",
    "df_customer.drop(['Title','Year'], axis=1, inplace=True)\n",
    "df_customer"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "用户的json信息如下，比如这里是对于`CustomerID`为0的用户，有包含`MovieID`和打分的字典。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'1011': 3.0, '319': 3.0, '48': 3.0, '58': 3.0, '783': 3.0, '837': 4.0}"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_query = df_customer.drop(['CustomerID'], axis=1).set_index('MovieID')\n",
    "dict_query = df_query.to_dict()['Rating']\n",
    "dict_query"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "API定义在[api.py](api.py)文件中，当服务启动的时候，会加载训练好的模型到内存中。main函数 `/recommend`以json形式接收`dict_query`，通过autoencoder完成计算，返回另外一个json(预测打分)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### <font color=red>在当前目录下打开命令行窗口，输入如下命令启动服务:</font>\n",
    "python api.py"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "end_point = 'http://127.0.0.1:5000/'\n",
    "end_point_recommend = \"http://127.0.0.1:5000/recommend\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Yeah, yeah, I highly recommend it\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current\n",
      "                                 Dload  Upload   Total   Spent    Left  Speed\n",
      "\n",
      "  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0\n",
      "100    33  100    33    0     0     33      0  0:00:01 --:--:--  0:00:01  2062\n"
     ]
    }
   ],
   "source": [
    "!curl $end_point"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "我们通过`dict_query`来向推荐系统发起请求"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "False\n",
      "{\n",
      "  \"error\": \"Server Internal Error\"\n",
      "}\n"
     ]
    }
   ],
   "source": [
    "headers = {'Content-type':'application/json'}\n",
    "res = requests.post(end_point_recommend, data=json.dumps(dict_query), headers=headers)\n",
    "print(res.ok)\n",
    "print(json.dumps(res.json(), indent=2))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<font color=red>原始课件中 reco_encoder/data/ 下缺少 input_layer_api.py 这个模块，代码调试时直接用 input_layer.py 这个模块做了修改替换，接口不对应，所以会有错误。</font>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 压测\n",
    "如果我们想看一看我们推荐系统的稳定性，可以做一个压测，频繁发起一些请求。大家可以在[load_test.py](load_test.py)中找到压测的代码，我们可以通过调整`NUM`和`CONCURRENT`来控制轮次和并发数。这里测试的服务器`NUM`设定为10，并发为2，最后测试结果大概是4ms左右的响应时间，实际上并发为2的相应速度基本都差不多，如果把并发数提到20的话，响应时间就会上升为12ms\n",
    "\n",
    "在实际应用中，请求并不从同一台电脑发出，所以大家还得加上客户端和服务器之间的通信延迟等等。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "NUM = 10\n",
    "CONCURRENT = 2\n",
    "VERBOSE = True\n",
    "payload = {13:5.0, 191:5.0, 209:5.0}\n",
    "payload_list = [payload]*NUM"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "async def main():\n",
    "    async with aiohttp.ClientSession() as session:\n",
    "        run_load_test(end_point_recommend, payload_list, session, CONCURRENT, VERBOSE)\n",
    "        \n",
    "loop = asyncio.get_event_loop()\n",
    "loop.run_until_complete(main())"
   ]
  }
 ],
 "metadata": {
  "anaconda-cloud": {},
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.3"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": false,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
